Skip to content

Commit 6ecaccb

Browse files
fix(server): keep goose built-in tools out of MCP classification
goose tags its built-in extensions (developer__shell, edits) with extensionName exactly like user MCP servers, so treating every foreign origin as MCP turned shell commands and file edits into generic "Used developer integration" tools. Only qwen's serverId assertion now yields an external MCP identity. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 7f3e86e commit 6ecaccb

2 files changed

Lines changed: 29 additions & 14 deletions

File tree

‎apps/server/src/provider/acp/AcpRuntimeModel.test.ts‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,11 +1540,6 @@ describe("extractMcpToolCallIdentity", () => {
15401540
});
15411541

15421542
it.each([
1543-
{
1544-
_meta: {
1545-
goose: { toolCall: { toolName: "weather__get_weather", extensionName: "weather" } },
1546-
},
1547-
},
15481543
{ _meta: { claudeCode: { toolName: "mcp__weather__get_weather" } } },
15491544
{ _meta: { toolName: "mcp::weather::get_weather", serverId: "weather" } },
15501545
])("recovers external MCP identity from provider metadata", (metadata) => {
@@ -1561,6 +1556,26 @@ describe("extractMcpToolCallIdentity", () => {
15611556
});
15621557
});
15631558

1559+
it.each([
1560+
{ kind: "execute", toolName: "developer__shell", extensionName: "developer" },
1561+
{ kind: "edit", toolName: "developer__edit", extensionName: "developer" },
1562+
{ kind: "other", toolName: "weather__get_weather", extensionName: "weather" },
1563+
] as const)(
1564+
"leaves goose $toolName unclassified so built-ins keep their projection",
1565+
({ kind, toolName, extensionName }) => {
1566+
// goose tags built-in extensions exactly like user MCP servers.
1567+
const toolCall = toolCallFromUpdate({
1568+
sessionUpdate: "tool_call",
1569+
toolCallId: "goose-builtin",
1570+
kind,
1571+
title: "developer: shell",
1572+
status: "in_progress",
1573+
_meta: { goose: { toolCall: { toolName, extensionName } } },
1574+
});
1575+
expect(extractMcpToolCallIdentity(toolCall)).toBeUndefined();
1576+
},
1577+
);
1578+
15641579
it("uses the asserted server instead of a misleading T3 title", () => {
15651580
const toolCall = toolCallFromUpdate({
15661581
sessionUpdate: "tool_call",

‎apps/server/src/provider/acp/AcpRuntimeModel.ts‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,17 +1163,17 @@ export function extractMcpToolCallIdentity(
11631163
const assertsForeignOrigin =
11641164
(metaServerId.length > 0 && !/^t3[-_ ]?code$/i.test(metaServerId)) ||
11651165
(gooseExtension.length > 0 && !/^t3[-_ ]?code$/i.test(gooseExtension));
1166+
// A foreign origin never brands as T3. qwen's serverId marks a real MCP
1167+
// server, but goose reports its built-in extensions (developer__shell,
1168+
// edits) the same way as user MCP servers, so goose stays unclassified and
1169+
// keeps its command and file-change projections.
11661170
if (assertsForeignOrigin) {
1167-
const server = metaServerId || gooseExtension;
1168-
const name =
1169-
metaToolName ||
1170-
(typeof gooseToolCall?.toolName === "string" ? gooseToolCall.toolName.trim() : "");
1171-
if (!name) return undefined;
1172-
const prefix = [`mcp__${server}__`, `mcp::${server}::`, `${server}__`].find((prefix) =>
1173-
name.startsWith(prefix),
1171+
if (metaServerId.length === 0 || metaToolName.length === 0) return undefined;
1172+
const prefix = [`mcp__${metaServerId}__`, `mcp::${metaServerId}::`].find((prefix) =>
1173+
metaToolName.startsWith(prefix),
11741174
);
1175-
const tool = prefix === undefined ? name : name.slice(prefix.length);
1176-
return tool ? { server, tool } : undefined;
1175+
const tool = prefix === undefined ? metaToolName : metaToolName.slice(prefix.length);
1176+
return tool ? { server: metaServerId, tool } : undefined;
11771177
}
11781178
const candidates = [
11791179
meta?.toolName,

0 commit comments

Comments
 (0)