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

Function toComment

pkg/tools/codemode/functions.go:20–42  ·  view source on GitHub ↗
(tool *tools.Tool)

Source from the content-addressed store, hash-verified

18}
19
20func toComment(tool *tools.Tool) string {
21 var comment strings.Builder
22
23 inputSchema, _ := json.MarshalIndent(tool.Parameters, " * ", " ")
24 outputSchema, _ := json.MarshalIndent(tool.OutputSchema, " * ", " ")
25
26 comment.WriteString("\n/**\n")
27 for line := range strings.SplitSeq(tool.Description, "\n") {
28 comment.WriteString(" * " + strings.TrimSpace(line) + "\n")
29 }
30 comment.WriteString(" * \n")
31 comment.WriteString(" * @param args - Input object containing the parameters.\n")
32 comment.WriteString(" * @returns Output - The result of the function execution.\n")
33 comment.WriteString(" *\n")
34 comment.WriteString(" * Where Input follows the following JSON schema:\n")
35 comment.WriteString(" * " + string(inputSchema) + "\n")
36 comment.WriteString(" *\n")
37 comment.WriteString(" * And Output follows the following JSON schema:\n")
38 comment.WriteString(" * " + string(outputSchema) + "\n")
39 comment.WriteString(" */\n")
40
41 return comment.String()
42}

Callers 1

toolToJsDocFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected