From e670f7498a27ccd10ecafd5ea827fb12b7157784 Mon Sep 17 00:00:00 2001 From: agent_vscode Date: Sat, 11 Jul 2026 00:03:34 +0300 Subject: [PATCH] =?UTF-8?q?fix(ai-chat):=20sync=20CORE=5FTOOL=5FKEYS=20wit?= =?UTF-8?q?h=20#443=20core=20tools=20=E2=80=94=20restore=20mcp-server-pari?= =?UTF-8?q?ty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The #443 merge added getTree and getPageContext to the shared registry (packages/mcp/src/tool-specs.ts) with tier 'core', but the server-side authoritative core list CORE_TOOL_KEYS was never updated. Two guard tests in tool-tiers.spec.ts failed on develop (CI job test / mcp-server-parity): tier agreement SHARED_TOOL_SPECS <-> CORE_TOOL_SET, and the live-toolset <-> deferred-catalog partition (both tools were live, non-core and absent from the catalog). - add 'getTree' and 'getPageContext' to CORE_TOOL_KEYS (kept core, not demoted: cheap single-call navigation tools; core listPages description itself points to getTree) - update the CORE_TOOL_KEYS JSDoc accordingly - pin the first tool-tiers spec to the new 17-entry list with membership assertions for both #443 tools Co-Authored-By: Claude Fable 5 --- .../src/core/ai-chat/tools/tool-tiers.spec.ts | 6 ++++-- .../src/core/ai-chat/tools/tool-tiers.ts | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/server/src/core/ai-chat/tools/tool-tiers.spec.ts b/apps/server/src/core/ai-chat/tools/tool-tiers.spec.ts index 0c99f195..9b8cf182 100644 --- a/apps/server/src/core/ai-chat/tools/tool-tiers.spec.ts +++ b/apps/server/src/core/ai-chat/tools/tool-tiers.spec.ts @@ -27,10 +27,12 @@ import type { DocmostClientLike } from './docmost-client.loader'; */ describe('tool tier metadata (#332)', () => { - it('core set is the documented 13 + searchInPage + insertFootnote (15)', () => { - expect(CORE_TOOL_KEYS).toHaveLength(15); + it('core set is the documented 13 + searchInPage + insertFootnote + getTree + getPageContext (17, #443)', () => { + expect(CORE_TOOL_KEYS).toHaveLength(17); expect(CORE_TOOL_SET.has('searchInPage')).toBe(true); // #330, promoted to core expect(CORE_TOOL_SET.has('insertFootnote')).toBe(true); // #410, promoted to core + expect(CORE_TOOL_SET.has('getTree')).toBe(true); // #443, promoted to core + expect(CORE_TOOL_SET.has('getPageContext')).toBe(true); // #443, promoted to core // loadTools is a meta-tool, not a normal core key. expect(CORE_TOOL_SET.has(LOAD_TOOLS_NAME)).toBe(false); }); diff --git a/apps/server/src/core/ai-chat/tools/tool-tiers.ts b/apps/server/src/core/ai-chat/tools/tool-tiers.ts index 1e74c86a..add0e09e 100644 --- a/apps/server/src/core/ai-chat/tools/tool-tiers.ts +++ b/apps/server/src/core/ai-chat/tools/tool-tiers.ts @@ -39,12 +39,14 @@ export interface ToolCatalogEntry { /** * CORE (always-active) in-app tool keys — 13 frequent/tiny tools + `searchInPage` - * (#330) + `insertFootnote` (#410). `searchInPage` is core because it is frequent - * for the editorial roles this feature targets; `insertFootnote` is core so the - * footnote tool is NOT hidden while its natural sibling `editPageText` is always - * active (that asymmetry is exactly what pushed the agent to write literal - * `^[...]`). `loadTools` is active too but is not a normal tool key (it is added - * to activeTools separately). + * (#330) + `insertFootnote` (#410) + `getTree`/`getPageContext` (#443). + * `searchInPage` is core because it is frequent for the editorial roles this + * feature targets; `insertFootnote` is core so the footnote tool is NOT hidden + * while its natural sibling `editPageText` is always active (that asymmetry is + * exactly what pushed the agent to write literal `^[...]`). `getTree` and + * `getPageContext` are the single-call navigation/lookup tools — core so the + * agent never has to loadTools just to orient itself. `loadTools` is active too + * but is not a normal tool key (it is added to activeTools separately). */ export const CORE_TOOL_KEYS = [ 'searchPages', @@ -66,6 +68,11 @@ export const CORE_TOOL_KEYS = [ // #410 insertFootnote — core so pinpoint citations to already-written text // don't degrade into literal `^[...]`; kept symmetric with editPageText. 'insertFootnote', + // #443 getTree + getPageContext — cheap single-call navigation/lookup tools + // (the core listPages even points to getTree); core so the agent never has + // to loadTools just to orient itself. + 'getTree', + 'getPageContext', ] as const; /** O(1) membership test for the core tier. */