MCP server: dashboard tool schemas use $ref as a property name, breaking Kimi/Moonshot API clients (400 invalid schema)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.5k
- Forks
- 290
- Avg merge
- 21h 22m
- Merged PRs (30d)
- 99
Description
Describe the bug
The hosted Logfire MCP server (https://logfire-us.pydantic.dev/mcp) exposes tool schemas that are rejected by the Moonshot/Kimi chat completions API (e.g. model kimi-for-coding via the kimi-code provider) with HTTP 400, before any tool call happens:
400 tools.function.parameters is not a valid moonshot flavored json schema, details: <At path 'properties.definition.anyOf.properties.spec.properties.layouts.items.properties.spec.properties.items.items.properties.content.properties.$ref': $ref must be a string>
The whole /chat/completions request is rejected because the tools payload contains one invalid schema. This makes the Logfire MCP server unusable from any client backed by the Kimi/Moonshot API (e.g. coding agents dispatching sub-agents on kimi-for-coding), while clients using other providers (Anthropic, OpenAI, DeepSeek) work fine.
Root cause
The dashboard_create and dashboard_update tools accept a Perses-compatible dashboard definition. Inside that schema, the grid layout item content object uses $ref as a plain property name (Perses panels are referenced as {"$ref": "#/spec/panels/..."}):
"content": {
"properties": {
"$ref": { "type": "string" }
},
"required": ["$ref"],
"type": "object"
}
This is valid JSON Schema (draft 2020-12) — $ref here is just a data field name. However, the Moonshot/Kimi API validator treats the property name $ref as the JSON Schema keyword $ref (whose value must be a string JSON Pointer), sees an object instead, and rejects the entire tools payload.
Expected behavior
The MCP server should not emit schemas that break stricter JSON Schema validators. Possible fixes:
- Avoid
$refas a property name in the tool input schema (e.g. rename the field, or describe panel references with a different keyword). - Or adjust the emitted schema so strict validators that special-case
$refdo not reject it.
Environment
- MCP endpoint:
https://logfire-us.pydantic.dev/mcp(remote hosted server) - Client: oh-my-pi coding harness dispatching sub-agents on
kimi-code/kimi-for-coding - Affected tools:
dashboard_create,dashboard_update(also surfaced asmcp__logfire_dashboard_create/mcp__logfire_dashboard_update) - Related: https://github.com/pydantic/logfire-mcp/issues/37 (archived repo) reported a similar "JSON schema is invalid" rejection from Claude Code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the hosted MCP endpoint and inspect how the dashboard_create and dashboard_update tools generate schemas for the Perses-compatible definition input. Reproduce the tools payload against a Moonshot/Kimi validator, then verify that the emitted schema is accepted without breaking clients that currently work. Done means both affected tool schemas no longer trigger the reported invalid-$ref error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai-infra-agents, api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100