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

Method Instructions

pkg/tools/builtin/shell/script_shell.go:123–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121}
122
123func (t *ScriptToolSet) Instructions() string {
124 var sb strings.Builder
125 sb.WriteString("## Custom Shell Tools\n\n")
126
127 names := make([]string, 0, len(t.shellTools))
128 for name := range t.shellTools {
129 names = append(names, name)
130 }
131 slices.Sort(names)
132
133 for _, name := range names {
134 tool := t.shellTools[name]
135 fmt.Fprintf(&sb, "### %s\n", name)
136 if tool.Description != "" {
137 fmt.Fprintf(&sb, "%s\n", tool.Description)
138 } else {
139 fmt.Fprintf(&sb, "Runs: `%s`\n", tool.Cmd)
140 }
141
142 argNames := make([]string, 0, len(tool.Args))
143 for argName := range tool.Args {
144 argNames = append(argNames, argName)
145 }
146 slices.Sort(argNames)
147 for _, argName := range argNames {
148 argDef := tool.Args[argName]
149 description := ""
150 if m, ok := argDef.(map[string]any); ok {
151 if d, ok := m["description"].(string); ok {
152 description = d
153 }
154 }
155 required := ""
156 if slices.Contains(tool.Required, argName) {
157 required = " (required)"
158 }
159 if description != "" {
160 fmt.Fprintf(&sb, "- `%s`: %s%s\n", argName, description, required)
161 } else {
162 fmt.Fprintf(&sb, "- `%s`%s\n", argName, required)
163 }
164 }
165 sb.WriteString("\n")
166 }
167
168 return sb.String()
169}
170
171func (t *ScriptToolSet) Tools(context.Context) ([]tools.Tool, error) {
172 var toolsList []tools.Tool

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected