feat: flag unportable tool schemas in all three clients
Closes #1005 A tool schema can be perfectly legal JSON Schema and still be rejected by the client the server is meant to run against — Go's `jsonschema` emits a bare `true` for `interface{}`, which the SDK accepts and Claude Code refuses with an opaque "Invalid input". The Inspector passed it through silently. Adds `core/json/schemaLint.ts`, a portability lint over a tool's inputSchema/outputSchema, and surfaces one shared verdict everywhere: the CLI's `--strict` report (exit 6 on an error-severity finding), the TUI's tool list marker + detail pane, and the web Tools sidebar flag + detail section. Deliberately not a JSON Schema validator: a census of 617 public servers found zero that fail the SDK's own parse, so a conformance check would report nothing on real servers. Each rule is instead a construct that is legal JSON Schema and known to be refused or mishandled by a shipping client — a bare boolean in a schema position, an array-form `type`, a remote `$ref`, a schema with no validation keyword, a non-object root. `test-servers/configs/unportable-schemas-http.json` exercises every rule, via a new `rawToolSchemas` override — the Zod-built presets cannot emit any of these shapes, which is the same reason a real server only hits this when its schemas come from another generator. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UL9retfvAXRgvi6EWk4SY4 Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
2b129087a3
commit
2f9e0901c1
1 changed files with 1979 additions and 13 deletions
|
|
@ -56,6 +56,27 @@ Components live under `src/components/` in four layers, smallest to largest:
|
|||
|
||||
Every screen and element has a `*.stories.tsx` (see [Storybook](#storybook)). Styling follows the Mantine-first rules in [`AGENTS.md`](../../AGENTS.md) — theme variants and component props over CSS, `--inspector-*` tokens over raw colors.
|
||||
|
||||
## Tool-schema portability (`#1005`)
|
||||
|
||||
The Tools tab flags tools whose advertised `inputSchema` / `outputSchema`
|
||||
carries a construct that is legal JSON Schema and is refused or mishandled by
|
||||
real MCP clients — the reported case being Go's `jsonschema` package emitting a
|
||||
bare `true` for an `interface{}` field, which Claude Code rejects with an
|
||||
opaque `"Invalid input"`.
|
||||
|
||||
Two surfaces, one verdict: the sidebar row (`ToolListItem`) carries a
|
||||
hover-labelled icon — red when something is refused outright, yellow when it is
|
||||
merely handled unevenly — and selecting the tool renders a **Schema
|
||||
portability** section (`SchemaFindingsList`) above the argument form, one block
|
||||
per finding with its path, the problem, and a concrete fix.
|
||||
|
||||
Both read [`core/json/schemaLint.ts`](../../core/json/schemaLint.ts), which is
|
||||
also what backs the TUI's detail pane and the CLI's `--strict` report — so the
|
||||
three clients cannot disagree about whether a schema is portable. That module's
|
||||
header explains why it is a portability lint rather than a JSON Schema
|
||||
validator. `test-servers/configs/unportable-schemas-http.json` is a server that
|
||||
exercises every rule.
|
||||
|
||||
## Non-component code: `src/lib` vs `src/utils`
|
||||
|
||||
Two grab-bag directories, split by one rule: **`utils` = functions that compute; `lib` = things that instantiate, adapt, or touch the environment.** If it does I/O or wraps a subsystem, it's `lib`; if it's a pure transform, it's `utils`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue