Skip to content

Commit 80157eb

Browse files
committed
mcp tool call: add dummy argument if there are no arguments given
1 parent 79b736c commit 80157eb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/mcp/client/tool_call.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ func CallTool(ctx context.Context, tp Transporter, toolName string, argsAsJson s
2020
if err != nil {
2121
return nil, fmt.Errorf("failed to unmarshal tool call arguments: %w", err)
2222
}
23+
if len(req.Params.Arguments) == 0 {
24+
req.Params.Arguments = map[string]any{
25+
"_": "_", // some tools require at least one argument, so we add a dummy one
26+
}
27+
}
2328

2429
execCtx, cancel := tp.GetTimeouts().ExecutionContext(ctx)
2530
defer cancel()

0 commit comments

Comments
 (0)