: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): advertise exec tool annotations on tools/list (#101294)
Rafael Audibert38ae7b0e3301
diff --git a/services/mcp/src/hono/instructions.ts b/services/mcp/src/hono/instructions.tsindex 954d06ba0684..4deb988b3dc5 100644--- a/services/mcp/src/hono/instructions.ts+++ b/services/mcp/src/hono/instructions.ts@@ -13,6 +13,7 @@ import EXECUTE_SQL_PROMPT from '@/templates/execute-sql-prompt.md'import CATALOG_TRUST_DISCOVERY from '@/templates/sections/catalog-trust-discovery.md'import METRIC_DISCOVERY from '@/templates/sections/metric-discovery.md'import SCHEMA_DISCOVERY from '@/templates/sections/schema-discovery.md'+import { EXEC_TOOL_ANNOTATIONS } from '@/tools/exec'import { ExecLearnCatalog } from '@/tools/exec-learn'import {getRenderableToolNames,@@ -89,6 +90,7 @@ export class InstructionsBuilder {title: 'Execute PostHog command',description: this.buildExecToolDescription(state),inputSchema: { type: 'object', properties: ExecSchema, required: ['command'] },+ annotations: { ...EXEC_TOOL_ANNOTATIONS },}}diff --git a/services/mcp/src/tools/exec.ts b/services/mcp/src/tools/exec.tsindex 179a7d5bd22d..7659e2e3c0c7 100644--- a/services/mcp/src/tools/exec.ts+++ b/services/mcp/src/tools/exec.ts@@ -33,6 +33,16 @@ import {* forcing catastrophic backtracking against tool metadata. */const MAX_SEARCH_PATTERN_LENGTH = 400+/** 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. */+export const EXEC_TOOL_ANNOTATIONS = {+ destructiveHint: true,+ idempotentHint: false,+ openWorldHint: true,+ readOnlyHint: false,+} as const+/** One line telling the agent third-party tools exist and how to find them, for the* `tools` listing. Returns undefined when nothing is connected. */async function resolveConnectedSummary(@@ -1366,12 +1376,7 @@ export function createExecTool(description: toolDescription,schema: ExecSchema,scopes: [],- annotations: {- destructiveHint: false,- idempotentHint: false,- openWorldHint: true,- readOnlyHint: false,- },+ annotations: { ...EXEC_TOOL_ANNOTATIONS },handler: async (_context: Context, params: z.infer<ExecSchema>) => {const { verb, rest } = parseCommand(params.command)// Reported up front so a command that throws (unknown tool, bad regex) still