MCPcopy
hub / github.com/TanStack/ai / buildToolDescription

Function buildToolDescription

packages/ai-code-mode/src/create-code-mode-tool.ts:269–284  ·  view source on GitHub ↗

* Build the tool description including available external functions

(tools: Array<CodeModeTool>)

Source from the content-addressed store, hash-verified

267 * Build the tool description including available external functions
268 */
269function buildToolDescription(tools: Array<CodeModeTool>): string {
270 const eager = tools.filter((t) => !t.lazy)
271 const hasLazy = tools.some((t) => t.lazy)
272 const externalFunctions = eager.map((t) => `external_${t.name}`).join(', ')
273
274 const discoverable = hasLazy
275 ? ` Additional functions can be discovered via the discover_tools tool.`
276 : ''
277
278 return (
279 `Execute TypeScript code in a secure sandbox environment. ` +
280 `The code can use these external API functions: ${externalFunctions}.${discoverable} ` +
281 `All external_* calls are async and must be awaited. ` +
282 `Return a value to pass results back. Use console.log() for debugging.`
283 )
284}

Callers 1

createCodeModeToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected