Feature: Agent-accessible config diagnostics tool (programmatic /doctor)
Problem
When Claude Code's agent encounters a configuration error (e.g., invalid MCP server schema, malformed settings), it has no programmatic way to diagnose the issue. The agent can read config files but cannot validate them against schemas or check connection status.
Real-world example: I wrote "type": "url" in .mcp.json when the correct value was "type": "sse". The agent had no way to detect this — the user had to manually run /doctor, screenshot the error, and share it back. This round-trip is slow and defeats the purpose of an autonomous coding agent.
Current state
/doctorandclaude doctorexist but are user-facing only — the agent cannot invoke them or read their outputmcp__ide__getDiagnosticsexists for IDE/LSP diagnostics but not for Claude Code's own config- Community tools (cc-health-check, claude-config-doctor, claude-health) fill gaps but aren't integrated
- Related issues: #29824 (MCP validation), #6846 (SDK health monitoring)
Proposal
Expose a tool (or set of tools) that allows the agent to programmatically access diagnostic information, similar to what /doctor provides:
getDiagnostics() → {
mcp_servers: [{ name, status, errors }],
settings: { valid, errors },
keybindings: { valid, errors },
plugins: [{ name, status, errors }],
version: { current, latest }
}
This would let the agent:
- Self-diagnose config issues instead of asking the user to run
/doctor - Validate changes before suggesting a restart (e.g., after editing
.mcp.json) - Proactively fix schema errors, missing fields, or invalid values
Alternatives considered
- Running
claude doctorvia Bash: Not available inside the agent's session - Schema validation in the agent: Possible but fragile — schemas change, and connection status can't be checked this way
- Community skills: Useful but don't have access to internal state (connection status, runtime errors)
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗