MCPcopy
hub / github.com/docker/docker-agent / TestCodeModeTool_Tools

Function TestCodeModeTool_Tools

pkg/tools/codemode/codemode_test.go:14–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestCodeModeTool_Tools(t *testing.T) {
15 t.Parallel()
16 tool := &codeModeTool{}
17
18 toolSet, err := tool.Tools(t.Context())
19 require.NoError(t, err)
20 require.Len(t, toolSet, 1)
21
22 fetchTool := toolSet[0]
23 assert.Equal(t, "run_tools_with_javascript", fetchTool.Name)
24 assert.Equal(t, "code mode", fetchTool.Category)
25 assert.NotNil(t, fetchTool.Handler)
26
27 inputSchema, err := json.Marshal(fetchTool.Parameters)
28 require.NoError(t, err)
29 assert.JSONEq(t, `{
30 "type": "object",
31 "required": [
32 "script"
33 ],
34 "properties": {
35 "script": {
36 "type": "string",
37 "description": "Script to execute"
38 }
39 },
40 "additionalProperties": false
41}`, string(inputSchema))
42
43 outputSchema, err := json.Marshal(fetchTool.OutputSchema)
44 require.NoError(t, err)
45 assert.JSONEq(t, `{
46 "type": "object",
47 "required": [
48 "value",
49 "stdout",
50 "stderr"
51 ],
52 "properties": {
53 "stderr": {
54 "type": "string",
55 "description": "The standard error of the console"
56 },
57 "stdout": {
58 "type": "string",
59 "description": "The standard output of the console"
60 },
61 "value": {
62 "type": "string",
63 "description": "The value returned by the script"
64 },
65 "tool_calls": {
66 "type": ["null", "array"],
67 "description": "The list of tool calls made during script execution, only included on failure",
68 "items": {
69 "type": "object",
70 "additionalProperties": false,
71 "required": ["name", "arguments"],

Callers

nothing calls this directly

Calls 3

ToolsMethod · 0.95
ContextMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected