Agent / foldkit-agent-mcp
Protocol errors vs application refusals
MCP distinguishes a malformed/invalid protocol call from a valid call the application refuses. This adapter preserves that distinction:
| Situation | MCP result |
|---|---|
| unknown tool name | JSON-RPC error -32602 |
| arguments fail the advertised input schema | JSON-RPC error -32602 |
| capability is currently unavailable | tool result with isError: true |
| principal is unauthorized | tool result with isError: true |
| invocation is cancelled | tool result with isError: true |
| declared completion fails | tool result with isError: true |
That matters because a client may treat JSON-RPC errors as malformed requests or transport/protocol faults. An authorization refusal is an application decision, not a broken MCP call.
A capability can also disappear between tools/list and tools/call. That
call remains syntactically valid, so it returns a tool error rather than
-32602.
Availability follows the Model
tools/list is dynamic. If a capability's available(model) changes, the tool
appears or disappears with the live application state.
The adapter emits notifications/tools/list_changed only when that advertised
set actually changes, not on every Model transition. Use debounceMs when the
capability set itself can flap rapidly.
Availability is also enforced at invocation time. Knowing a previously advertised tool name does not bypass the current Model boundary.