Skip to content

[Repo Assist] feat(mcp): add per-command JSON Schema to tools/list#262

Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/feat-mcp-input-schemas-2026-05-02-c3518e3a54a6ee1b
Draft

[Repo Assist] feat(mcp): add per-command JSON Schema to tools/list#262
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/feat-mcp-input-schemas-2026-05-02-c3518e3a54a6ee1b

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 2, 2026

🤖 This is an automated pull request from Repo Assist.

Summary

Every tool advertised via tools/list now carries a curated JSON Schema in its inputSchema field instead of the generic permissive fallback (additionalProperties: true). This was the first deferred item in docs/MCP_MODE.md.

MCP clients (Cursor, Claude Desktop, etc.) will now receive accurate parameter types, required-field lists, and enum constraints — without having to infer argument shapes from descriptions and trial-and-error.

What changed

McpToolBridge.cs

  • Added CommandSchemas — static dictionary mapping every known command to its full JSON Schema, built once at startup from raw JSON literals.
  • Added KnownSchemas — public property exposing the dict for tests and documentation drift-checking.
  • HandleToolsList: looks up per-command schema; unknown/future commands still fall back to the permissive schema, so newly-added capabilities continue to render without a code change here.
  • Added descriptions for four commands that were advertised by capabilities but missing from CommandDescriptions: location.get, device.info, device.status, browser.proxy.

Highlights from the schemas

Command Required args Key constraints
system.run / system.run.prepare command command accepts string or string[] via oneOf
system.which bins minItems: 1
system.execApprovals.set rules Rule items require pattern + action; action is enum
screen.record durationMs maximum: 300000, fps bounded 1–60
camera.clip durationMs maximum: 60000
tts.speak text provider restricted to ["windows","elevenlabs"]
canvas.navigate url
canvas.a2ui.pushJSONL jsonlPath
browser.proxy path method restricted to ["GET","POST","DELETE"]

McpToolBridgeTests.cs — 15 new tests

  • ToolsList_KnownCommands_SchemaIncludesRequiredField — theory (9 cases) verifying required arrays for commands that have mandatory args.
  • ToolsList_UnknownCommand_GetsPermissiveSchema — unknown commands still receive additionalProperties:true.
  • ToolsList_KnownCommand_DoesNotHaveAdditionalPropertiesTrue — known commands do not have the permissive flag.
  • KnownSchemas_ContainsAllKnownCommands — drift guard: every command in KnownCommands must have a curated schema.
  • KnownSchemas_SystemRun_HasPropertiesForAllDocumentedArgs — spot-checks system.run properties.
  • KnownSchemas_TtsSpeak_ProviderEnumMatchesDocumentation — verifies provider enum values.
  • KnownSchemas_ExecApprovalsSet_RuleItemsHaveRequiredPatternAndAction — verifies rule-item required fields.

docs/MCP_MODE.md

  • Marked the "Per-tool input schemas" deferred item as implemented.

Trade-offs

  • Schemas live in McpToolBridge (same approach as CommandDescriptions) rather than on INodeCapability. This avoids an interface change that would require updating all capability implementations. The doc comment in MCP_MODE.md mentioned both approaches; the static dict approach is simpler and consistent with the existing pattern.
  • Schemas are parsed at startup from JSON string literals. This is less verbose than nested anonymous objects and keeps the JSON Schema structure readable.

Test Status

Suite Passed Failed Skipped
OpenClaw.Shared.Tests 1165 2 20
OpenClaw.Tray.Tests (not run — Linux CI; no WinUI runtime)

The 2 Shared.Tests failures (CanvasCapabilityTests.A2UIPush_WithJsonlPath_ReadsFile, A2UICapabilitySecurityTests.A2UIPush_FileJsonl_OverCap_ReturnsError) are pre-existing and unrelated to this change.

Closes: n/a (implements deferred item from docs/MCP_MODE.md)

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

Every command advertised by McpToolBridge now returns a curated
JSON Schema in the inputSchema field of tools/list instead of the
generic permissive fallback (additionalProperties:true).

Changes:
- McpToolBridge.CommandSchemas: new static dict with full JSON Schema
  for all 26 known commands (22 original + location.get, device.info,
  device.status, browser.proxy which were missing from CommandDescriptions).
- McpToolBridge.KnownSchemas: new public property exposing the dict for
  tests and documentation drift-checking.
- HandleToolsList: uses per-command schema when available, falls back to
  the permissive schema for unknown/future commands.
- McpToolBridgeTests: 15 new tests verifying required fields, enum
  constraints, schema coverage, and that unknown commands still get the
  permissive fallback.
- docs/MCP_MODE.md: mark the deferred per-tool-schema item as implemented.

This is the implementation of the first deferred item in MCP_MODE.md.
MCP clients (Cursor, Claude Desktop, etc.) now receive accurate parameter
types, required-field lists, and enum constraints — without needing to
infer arg shapes from descriptions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants