PostHog / PostHog/posthog

MCP tool `file-download-batch-exports-create` has a top-level `anyOf` input_schema → breaks Anthropic API clients (Claude Desktop/Code)

Open
#60,592 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Summary

The MCP tool file-download-batch-exports-create exposes an inputSchema whose root is an anyOf. The Anthropic Messages API rejects any tool input_schema that uses oneOf/allOf/anyOf at the top level, so this one tool breaks the entire PostHog MCP integration for Anthropic-API-backed clients (Claude Desktop, Claude Code).

Impact

Because clients send all connected tools in a single tools array, one invalid schema fails the whole request — not just calls to this tool. Every model turn 400s with:

API Error: 400 tools.N.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level

In Claude Code specifically, this breaks all built-in subagents (Explore/general-purpose/Plan) that eager-load connector tools — they can't start at all. The only user-side workaround is manually blocking this single tool in connector settings. Verified against the live tool catalog on 2026-05-28: file-download-batch-exports-create is the only PostHog MCP tool with a top-level union (every sibling has an {"type":"object"} root and works fine).

Root cause

In services/mcp/src/tools/generated/batch_exports.ts:

const FileDownloadBatchExportsCreateSchema = FileDownloadBatchExportsCreateBody   // union → anyOf at root
// vs the sibling, which is object-rooted:
const FileDownloadBatchExportsRetrieveSchema = FileDownloadBatchExportsRetrieveParams.omit({ project_id: true })

FileDownloadBatchExportsCreateBody is a union type, which zod-to-json-schema renders as a top-level anyOf. (Source: products/batch_exports/mcp/tools.yaml → generated batch_exports.ts.)

Suggested fix

Guarantee that every MCP tool inputSchema has a {"type":"object"} root. For a union request body, wrap the union under a single object property, e.g.:

{ "type": "object", "properties": { "body": { "anyOf": [ ... ] } }, "required": ["body"] }

(Nested anyOf is accepted by the Anthropic API — only the top level is rejected.) A generator-level guard that wraps/flags any top-level non-object schema for MCP inputSchema would prevent this whole class of breakage.

Environment

  • Client: Claude Desktop / Claude Code (Anthropic Messages API)
  • Observed: 2026-05-28

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with services/mcp/src/tools/generated/batch_exports.ts and compare the create schema with the object-rooted retrieve schema. Trace the generator input in products/batch_exports/mcp/tools.yaml and identify where MCP input schemas are emitted. Done means this tool has an object root with the union nested beneath it, without breaking the generated tool definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.