feat(core): allow MCP Code Mode opt-out (#37681)
Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
parent
33f1b269e9
commit
fe9b051d1a
6 changed files with 57 additions and 9 deletions
|
|
@ -655,6 +655,7 @@ describe("Config", () => {
|
|||
command: ["node", "./mcp/server.js"],
|
||||
environment: { API_KEY: "secret" },
|
||||
disabled: false,
|
||||
codemode: false,
|
||||
timeout: { catalog: 10000 },
|
||||
},
|
||||
remote: {
|
||||
|
|
@ -663,6 +664,7 @@ describe("Config", () => {
|
|||
headers: { Authorization: "Bearer token" },
|
||||
oauth: { client_id: "client", scope: "read write", callback_port: 19876 },
|
||||
disabled: true,
|
||||
codemode: false,
|
||||
timeout: { startup: 15000 },
|
||||
},
|
||||
},
|
||||
|
|
@ -740,6 +742,7 @@ describe("Config", () => {
|
|||
command: ["node", "./mcp/server.js"],
|
||||
environment: { API_KEY: "secret" },
|
||||
disabled: false,
|
||||
codemode: false,
|
||||
timeout: { catalog: 10000 },
|
||||
},
|
||||
remote: {
|
||||
|
|
@ -748,6 +751,7 @@ describe("Config", () => {
|
|||
headers: { Authorization: "Bearer token" },
|
||||
oauth: { client_id: "client", scope: "read write", callback_port: 19876 },
|
||||
disabled: true,
|
||||
codemode: false,
|
||||
timeout: { startup: 15000 },
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -232,6 +232,13 @@ const mcp = Layer.mock(MCP.Service, {
|
|||
required: ["ok"],
|
||||
},
|
||||
}),
|
||||
new MCP.Tool({
|
||||
server: MCP.ServerName.make("direct"),
|
||||
name: "lookup",
|
||||
codemode: false,
|
||||
description: "Lookup",
|
||||
inputSchema: { type: "object", properties: {} },
|
||||
}),
|
||||
]),
|
||||
callTool: (input) =>
|
||||
Effect.sync(() => {
|
||||
|
|
@ -766,6 +773,18 @@ it.effect("advertises MCP output schemas to Code Mode", () =>
|
|||
}),
|
||||
)
|
||||
|
||||
it.effect("advertises MCP tools directly when Code Mode is disabled for the server", () =>
|
||||
Effect.gen(function* () {
|
||||
const registry = yield* ToolRegistry.Service
|
||||
yield* waitForTool(registry, "direct_lookup")
|
||||
const definitions = yield* toolDefinitions(registry)
|
||||
const execute = definitions.find((tool) => tool.name === "execute")
|
||||
|
||||
expect(definitions.some((tool) => tool.name === "direct_lookup")).toBe(true)
|
||||
expect(execute?.description).not.toContain("tools.direct.lookup")
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("waits for permission before calling an MCP tool", () =>
|
||||
Effect.gen(function* () {
|
||||
calls = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue