:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(mcp): stop marking exec as destructive on tools/list (#106819)
posthog[bot]b11d9fa09773
diff --git a/services/mcp/src/tools/exec.ts b/services/mcp/src/tools/exec.tsindex 7b57f5e46f42..69fd6f151e52 100644--- a/services/mcp/src/tools/exec.ts+++ b/services/mcp/src/tools/exec.ts@@ -37,9 +37,11 @@ const MAX_SEARCH_PATTERN_LENGTH = 800/** Advertised on `tools/list` and on the runtime Tool. OpenAI's plugin verifier* requires these three hints (plus idempotent) to be present, not just defined- * on the handler side. */+ * on the handler side. `destructiveHint` stays false because every read goes+ * through `exec` too: Claude Code asks for approval on each call to a tool+ * marked destructive, even when the user set it to always allow. */export const EXEC_TOOL_ANNOTATIONS = {- destructiveHint: true,+ destructiveHint: false,idempotentHint: false,openWorldHint: true,readOnlyHint: false,diff --git a/services/mcp/tests/unit/exec-advertised-commands.test.ts b/services/mcp/tests/unit/exec-advertised-commands.test.tsindex c17843b8f75f..70f4116d8831 100644--- a/services/mcp/tests/unit/exec-advertised-commands.test.ts+++ b/services/mcp/tests/unit/exec-advertised-commands.test.ts@@ -167,3 +167,15 @@ describe('exec guidance advertises only resolvable commands', () => {expect(deadEnds).toEqual([])})})++describe('exec tool annotations on tools/list', () => {+ it('advertises every hint and does not mark exec as destructive', () => {+ const entry = new InstructionsBuilder('some guidelines').buildExecToolEntry(makeToolExecutorState([]))+ expect(entry.annotations).toEqual({+ destructiveHint: false,+ idempotentHint: false,+ openWorldHint: true,+ readOnlyHint: false,+ })+ })+})