Skip to content

Commit 243a9d3

Browse files
authored
test(agent): update local-tools tests for the always-on speak tool
Adding the always-enabled `speak` tool to LOCAL_TOOLS means the local-tools MCP server is now built on every session (desktop and cloud), not just when a cloud-only git tool's gate passes. - claude local-tools.test: a desktop run now exposes `speak` (and still omits the cloud-only signed-git tools), so assert that instead of an undefined server. - codex-agent.test: default the mocked existsSync to true in beforeEach so the always-on local-tools MCP script resolves; the "no structured-output" no-op cases now assert `posthog_output` is absent rather than the whole mcpServers array being empty; and the injection case looks up posthog_output by name since the local-tools server is also present. Generated-By: PostHog Code Task-Id: 3553940c-2b6e-41dd-bc02-27f5df786a29
1 parent 4edd354 commit 243a9d3

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

packages/agent/src/adapters/claude/mcp/local-tools.test.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,29 @@ describe("createLocalToolsMcpServer", () => {
2020
}
2121
});
2222

23-
it("returns undefined when no tool's gate passes (desktop run)", () => {
24-
expect(
25-
createLocalToolsMcpServer({ cwd: "/repo", token: "ghs_x" }, undefined),
26-
).toBeUndefined();
23+
it("exposes only the always-on tools on a desktop run (no cloud-only tools)", async () => {
24+
const server = createLocalToolsMcpServer(
25+
{ cwd: "/repo", token: "ghs_x" },
26+
undefined,
27+
);
28+
if (!server) {
29+
throw new Error("expected the local-tools server to be registered");
30+
}
31+
32+
const [clientTransport, serverTransport] =
33+
InMemoryTransport.createLinkedPair();
34+
await server.instance.connect(serverTransport);
35+
const client = new Client({ name: "test", version: "1.0.0" });
36+
await client.connect(clientTransport);
37+
38+
const { tools } = await client.listTools();
39+
const names = tools.map((t) => t.name);
40+
// `speak` is always on (narration works on desktop and cloud alike).
41+
expect(names).toContain("speak");
42+
// Signed-git tools are cloud-only and must not leak into a desktop run.
43+
expect(names).not.toContain("git_signed_commit");
44+
45+
await client.close();
2746
});
2847

2948
it("exposes git_signed_commit over MCP in a cloud run with a token", async () => {

0 commit comments

Comments
 (0)