Skip to content

feat(mcp,cli): MCP outputSchema forwarding + zeph doctor diagnostic (#2931, #2930)#3067

Merged
bug-ops merged 2 commits intomainfrom
mcp-output-schema-doctor
Apr 16, 2026
Merged

feat(mcp,cli): MCP outputSchema forwarding + zeph doctor diagnostic (#2931, #2930)#3067
bug-ops merged 2 commits intomainfrom
mcp-output-schema-doctor

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 16, 2026

Summary

Changes

feat(mcp): outputSchema forwarding

  • output_schema: Option<serde_json::Value> added to McpTool, ToolDef, ToolDefinition
  • rmcp Tool.output_schema captured at both registration paths in client.rs
  • Sanitizer extended: walks /output_schema with drop-on-injection; cross-ref scan runs on pre-drop snapshot; output_schemas_dropped counter
  • New config: mcp.forward_output_schema = false, mcp.output_schema_hint_bytes = 512
  • Claude + OpenAI backends append hint within combined description budget
  • tool_cache_key now hashes description + output_schema

feat(cli): zeph doctor

  • Command::Doctor variant in src/cli.rs
  • src/commands/doctor.rs: 15 async checks, plain + JSON (schema_version: 1) output
  • All detail strings through scrub_content (secrets + paths + URL creds)
  • SQLite probe is read-only (magic-byte check, no file creation)
  • Qdrant probe calls .health_check(), feature-gated
  • MCP probes wrapped in tokio::spawn + timeout + JoinError::is_panic()

fix(core): URL-credential redaction

  • URL_CREDS_REGEX in redact.rs strips scheme://user:pass@host in scrub_content

fix(clippy): pre-existing warnings

  • Duration unit, redundant closures, doc_markdown, mutex across await, and ~15 other clippy pedantic warnings across zeph-a2a, zeph-acp, zeph-bench, zeph-channels, zeph-core, zeph-index, zeph-llm, zeph-mcp, zeph-sanitizer, zeph-tools, zeph-tui

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features "desktop,ide,server,chat,pdf,scheduler" -- -D warnings — clean
  • cargo nextest run --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 8262 passed
  • LLM serialization gate: feature touches MCP registration and LLM tool-list build path — live session test required before merge
  • zeph doctor --config .local/config/testing.toml — validate output format and exit codes

Follow-up issues

  • Double-sanitization on tool list refresh (P1-4) — architectural decision pending
  • OpenAI insta snapshot tests for doctor redaction (GAP-2)
  • output_schemas_dropped audit log event

Add optional outputSchema forwarding from MCP tools to LLM tool
declarations. When `mcp.forward_output_schema = true` (default: false),
a bounded hint is appended to the tool description so the LLM can
reason about structured return values.

Key changes:
- Add `output_schema: Option<serde_json::Value>` to McpTool, ToolDef,
  and ToolDefinition (serde skip_serializing_if = "Option::is_none")
- Capture rmcp Tool.output_schema in both MCP registration paths
- Sanitizer extended to walk output_schema with /output_schema prefix;
  drop-on-injection policy; cross-ref scan runs on pre-drop snapshot
- New config fields: mcp.forward_output_schema (false), mcp.output_schema_hint_bytes (512)
- Claude and OpenAI backends append schema hint within combined budget
- tool_cache_key now hashes description + output_schema to prevent
  stale cache hits after server reconnect or operator toggle
- Add URL-credential redaction (scheme://user:pass@host) to scrub_content

Closes #2931
@github-actions github-actions Bot added enhancement New feature or request documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) skills zeph-skills crate labels Apr 16, 2026
@github-actions github-actions Bot added channels zeph-channels crate (Telegram) rust Rust code changes core zeph-core crate dependencies Dependency updates size/XL Extra large PR (500+ lines) labels Apr 16, 2026
@bug-ops bug-ops enabled auto-merge (squash) April 16, 2026 23:05
@bug-ops bug-ops merged commit 9e64761 into main Apr 16, 2026
32 checks passed
@bug-ops bug-ops deleted the mcp-output-schema-doctor branch April 16, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels zeph-channels crate (Telegram) core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/XL Extra large PR (500+ lines) skills zeph-skills crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant