diff --git a/src/gateway/server-methods/tools-catalog.test.ts b/src/gateway/server-methods/tools-catalog.test.ts index b806bbdd14d..79a60929760 100644 --- a/src/gateway/server-methods/tools-catalog.test.ts +++ b/src/gateway/server-methods/tools-catalog.test.ts @@ -19,7 +19,12 @@ const pluginToolMetaState = new Map ({ resolvePluginTools: vi.fn(() => [ { name: "voice_call", label: "voice_call", description: "Plugin calling tool" }, - { name: "matrix_room", label: "matrix_room", description: "Matrix room helper" }, + { + name: "matrix_room", + label: "matrix_room", + displaySummary: "Summarized Matrix room helper.", + description: "Matrix room helper\n\nACTIONS:\n- join\n- leave", + }, ]), getPluginToolMeta: vi.fn((tool: { name: string }) => pluginToolMetaState.get(tool.name)), })); @@ -119,6 +124,29 @@ describe("tools.catalog handler", () => { }); }); + it("summarizes plugin tool descriptions the same way as the effective inventory", async () => { + const { respond, invoke } = createInvokeParams({}); + await invoke(); + const call = respond.mock.calls[0] as RespondCall | undefined; + expect(call?.[0]).toBe(true); + const payload = call?.[1] as + | { + groups: Array<{ + source: "core" | "plugin"; + tools: Array<{ + id: string; + description: string; + }>; + }>; + } + | undefined; + const matrixRoom = (payload?.groups ?? []) + .filter((group) => group.source === "plugin") + .flatMap((group) => group.tools) + .find((tool) => tool.id === "matrix_room"); + expect(matrixRoom?.description).toBe("Summarized Matrix room helper."); + }); + it("opts plugin tool catalog loads into gateway subagent binding", async () => { const { invoke } = createInvokeParams({}); diff --git a/src/gateway/server-methods/tools-catalog.ts b/src/gateway/server-methods/tools-catalog.ts index 11462bdeaa2..98ccd13622c 100644 --- a/src/gateway/server-methods/tools-catalog.ts +++ b/src/gateway/server-methods/tools-catalog.ts @@ -9,6 +9,7 @@ import { PROFILE_OPTIONS, resolveCoreToolProfiles, } from "../../agents/tool-catalog.js"; +import { summarizeToolDescriptionText } from "../../agents/tool-description-summary.js"; import { loadConfig } from "../../config/config.js"; import { getPluginToolMeta, resolvePluginTools } from "../../plugins/tools.js"; import { @@ -105,10 +106,10 @@ function buildPluginGroups(params: { existing.tools.push({ id: tool.name, label: typeof tool.label === "string" && tool.label.trim() ? tool.label.trim() : tool.name, - description: - typeof tool.description === "string" && tool.description.trim() - ? tool.description.trim() - : "Plugin tool", + description: summarizeToolDescriptionText({ + rawDescription: typeof tool.description === "string" ? tool.description : undefined, + displaySummary: tool.displaySummary, + }), source: "plugin", pluginId, optional: meta?.optional,