fix(pier): a tools/call without arguments or with null arguments is an empty object
- MCP's tools/call arguments are optional; pier validated a JSON null against the input schema and refused every call of a tool without required input that an agent sent without arguments - found by plan 19.7-05's TestDispatch
This commit is contained in:
@@ -69,7 +69,9 @@ func (d *dispatcher) call(ctx context.Context, id Identity, info callInfo, t *to
|
||||
}
|
||||
|
||||
func (d *dispatcher) run(ctx context.Context, id Identity, info callInfo, t *tool, raw json.RawMessage) (*mcp.CallToolResult, int) {
|
||||
if len(bytes.TrimSpace(raw)) == 0 {
|
||||
// tools/call may omit arguments (or send null) for a tool without
|
||||
// required input; both mean an empty object.
|
||||
if trimmed := bytes.TrimSpace(raw); len(trimmed) == 0 || bytes.Equal(trimmed, []byte("null")) {
|
||||
raw = json.RawMessage("{}")
|
||||
}
|
||||
var parts map[string]json.RawMessage
|
||||
|
||||
Reference in New Issue
Block a user