Expand description
Argument-shape errors (spec/surface/README.md §4 “Arguments”, 3.0): every
tool call is checked against its ToolSpec’s
JSON schema ahead of dispatch, and a malformed call is one filter_invalid
whose message names what was expected — and, for an unknown argument name,
the nearest valid one. The reference (packages/core/src/mcp/arguments.ts)
composes the same messages byte for byte and the surface fixtures pin them
(every argument-shape error carries data.hint = "arguments").
Message forms (the (… takes …) tail lists the tool’s arguments in
bytewise order, optional ones marked ?; a tool without arguments “takes
no arguments”):
unknown argument `q`; did you mean `query`? (blocks_search takes limit?, q, repo?)
`doc` is no longer an argument — pass `id` or `path` (docs_read takes …)
`query` is required (query takes …)
`limit` must be an integer (query takes …)
pass id or path (docs_read takes …) — a locator tool called with neither
id "d_x" and path "/a.md" name different documents (…) — both given, disagreeingEnums§
- Json
Array String - What a string opening
[in a string-list slot reads as (4.11, the reference’sjsonArrayString).
Constants§
- DRY_
RUN_ RETIRED dry_runonapplyand every sugar tool (4.0): the preview isplan.- OPS_
RETIRED apply { ops }(4.0,spec/surface§4): the kernel opsapplytook through 3.x are a library/fixture contract (spec/mutate§4).
Functions§
- argument_
error - A
filter_invalidfor an argument-shape failure:messageplus the tool’s shape. - argument_
error_ fix argument_errorwith afix(4.5,spec/surface§4 “Arguments”) when the corrected call can be spelled.- arguments_
hint - The
(tool takes …)tail: property names in bytewise order,?on the ones not inrequired. - comma_
split - The parts of a comma-joined string: split on
,, trimmed, empty parts dropped. - json_
array_ string - A string whose trimmed form opens
[, read as JSON;Nonewhen it does not open[(the 4.5 rules apply unchanged). - levenshtein
- nearest
- The nearest candidate: Levenshtein distance ≤ 2, or a prefix relation either way; ties → the bytewise-first.
- phrase_
for - The expected-type phrase of an argument, as the reference spells it from its zod schema.
- unknown_
argument_ message - What to say about an argument name the tool does not take: the names 3.0
retired are called out with their replacement (
doc→id/path,block/node→id,heading→section,markdown→text) when the tool has the replacement, and so are the inputs 4.0 retired —ops(where the tool takeseffects: the kernel ops are a library/fixture contract),dry_run(every preview isplan),attrs(where the tool takeschecked); otherwise the nearest valid name (Levenshtein ≤ 2, or one a prefix of the other). - validate_
arguments - Check
argsagainst the tool’s schema: unknown names first (bytewise order), then each declared argument (bytewise order) for presence and type. Nested shapes (ops,expect,at) are checked by their handlers. Returns the arguments as the handler sees them when the check normalized one (4.5: a bare string in a string-list slot becomes[s]), elseNone.