MCPcopy
hub / github.com/CodebuffAI/codebuff / getToolsInstructions

Function getToolsInstructions

packages/agent-runtime/src/tools/prompts.ts:158–241  ·  view source on GitHub ↗
(
  tools: readonly string[],
  additionalToolDefinitions: NonNullable<
    z.input<typeof customToolDefinitionsSchema>
  >,
  options?: { availableSkillsXml?: string },
)

Source from the content-addressed store, hash-verified

156}
157
158export const getToolsInstructions = (
159 tools: readonly string[],
160 additionalToolDefinitions: NonNullable<
161 z.input<typeof customToolDefinitionsSchema>
162 >,
163 options?: { availableSkillsXml?: string },
164) => {
165 if (
166 tools.length === 0 &&
167 Object.keys(additionalToolDefinitions).length === 0
168 ) {
169 return ''
170 }
171
172 return `
173# Tools
174
175You (Buffy) have access to the following tools. Call them when needed.
176
177## [CRITICAL] Formatting Requirements
178
179Tool calls use a specific XML and JSON-like format. Adhere *precisely* to this nested element structure:
180
181${getToolCallString(
182 'tool_name',
183 {
184 parameter1: 'value1',
185 parameter2: 123,
186 },
187 false,
188 )}
189
190### Commentary
191
192Provide commentary *around* your tool calls (explaining your actions).
193
194However, **DO NOT** narrate the tool or parameter names themselves.
195
196### Example
197
198User: can you update the console logs in example/file.ts?
199Assistant: Sure thing! Let's update that file!
200
201${getToolCallString(
202 'example_editing_tool',
203 {
204 example_file_path: 'path/to/example/file.ts',
205 example_array: [
206 {
207 old_content_with_newlines:
208 "// some context\nconsole.log('Hello world!');\n",
209 new_content_with_newlines:
210 "// some context\nconsole.log('Hello from Buffy!');\n",
211 },
212 ],
213 },
214 false,
215 )}

Callers

nothing calls this directly

Calls 2

getToolCallStringFunction · 0.90
fullToolListFunction · 0.85

Tested by

no test coverage detected