Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(serve): --advertise=<surface> (the = form) sets the listing like --advertise <surface>

garrytan637cb7ccbba8
diff --git a/src/mcp/surface.ts b/src/mcp/surface.ts
index 78c8433818..e357b9bece 100644
--- a/src/mcp/surface.ts
+++ b/src/mcp/surface.ts
@@ -154,9 +154,10 @@ export function parseSurfaceFlag(args: string[]): McpSurface | null {
* absent, `mcp.advertised_surface` decides.
*/
export function parseAdvertiseFlag(args: string[]): McpSurface | null {
+ const inline = args.find(a => a.startsWith('--advertise='));
const idx = args.indexOf('--advertise');
- if (idx < 0) return null;
- const raw = args[idx + 1];
+ if (inline === undefined && idx < 0) return null;
+ const raw = inline !== undefined ? inline.slice('--advertise='.length) : args[idx + 1];
if (raw === undefined || raw.startsWith('--') || !isMcpSurface(raw)) {
throw opError('invalid_params', `gbrain serve --advertise takes verbs, starter or full${raw === undefined || raw.startsWith('--') ? '' : ` (got "${raw}")`}`,
'Run gbrain serve --advertise verbs (list the 7 memory verbs and request_tools), gbrain serve --advertise starter or gbrain serve --advertise full. Every tool the surface allows stays callable.');
diff --git a/test/mcp-advertised-surface.test.ts b/test/mcp-advertised-surface.test.ts
index 7c9240369c..a72f7896a8 100644
--- a/test/mcp-advertised-surface.test.ts
+++ b/test/mcp-advertised-surface.test.ts
@@ -69,6 +69,8 @@ describe('advertised surface (pure)', () => {
expect(parseAdvertiseFlag(['--surface', 'full'])).toBeNull();
expect(() => parseAdvertiseFlag(['--advertise', 'everything'])).toThrow('--advertise takes verbs, starter or full');
expect(() => parseAdvertiseFlag(['--advertise'])).toThrow('--advertise takes verbs, starter or full');
+ expect(parseAdvertiseFlag(['--advertise=verbs'])).toBe('verbs');
+ expect(() => parseAdvertiseFlag(['--advertise=everything'])).toThrow('--advertise takes verbs, starter or full');
});
test('the database plane wins over the file plane; unrecognized values advertise everything', async () => {