MCPcopy Index your code
hub / github.com/docker/docker-agent / TestResolveCommand_ToolCommandWithArgs

Function TestResolveCommand_ToolCommandWithArgs

pkg/runtime/commands_test.go:249–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestResolveCommand_ToolCommandWithArgs(t *testing.T) {
250 t.Parallel()
251
252 rt := &mockRuntime{
253 commands: types.Commands{
254 "greet": types.Command{Instruction: "Greeting: !greet_tool(name=World)"},
255 },
256 tools: []tools.Tool{
257 {
258 Name: "greet_tool",
259 Handler: func(_ context.Context, tc tools.ToolCall) (*tools.ToolCallResult, error) {
260 // Parse the args to verify they're passed correctly
261 return tools.ResultSuccess("Hello, " + tc.Function.Arguments), nil
262 },
263 },
264 },
265 }
266
267 result := ResolveCommand(t.Context(), rt, "/greet")
268 assert.Contains(t, result, "Greeting:")
269 assert.Contains(t, result, "World")
270}
271
272func TestResolveCommand_ToolCommandWithQuotedArgs(t *testing.T) {
273 t.Parallel()

Callers

nothing calls this directly

Calls 3

ResultSuccessFunction · 0.92
ResolveCommandFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected