(
tools: readonly string[],
additionalToolDefinitions: NonNullable<
z.input<typeof customToolDefinitionsSchema>
>,
options?: { availableSkillsXml?: string },
)
| 156 | } |
| 157 | |
| 158 | export 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 | |
| 175 | You (Buffy) have access to the following tools. Call them when needed. |
| 176 | |
| 177 | ## [CRITICAL] Formatting Requirements |
| 178 | |
| 179 | Tool 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 | |
| 192 | Provide commentary *around* your tool calls (explaining your actions). |
| 193 | |
| 194 | However, **DO NOT** narrate the tool or parameter names themselves. |
| 195 | |
| 196 | ### Example |
| 197 | |
| 198 | User: can you update the console logs in example/file.ts? |
| 199 | Assistant: 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 | )} |
nothing calls this directly
no test coverage detected