(params: {
toolName: string
schema: z.ZodType
description?: string
endsAgentStep: boolean
exampleInputs?: any[]
})
| 104 | |
| 105 | // Helper function to build the full tool description markdown |
| 106 | export function buildToolDescription(params: { |
| 107 | toolName: string |
| 108 | schema: z.ZodType |
| 109 | description?: string |
| 110 | endsAgentStep: boolean |
| 111 | exampleInputs?: any[] |
| 112 | }): string { |
| 113 | const { |
| 114 | toolName, |
| 115 | schema, |
| 116 | description = '', |
| 117 | endsAgentStep, |
| 118 | exampleInputs = [], |
| 119 | } = params |
| 120 | const descriptionWithExamples = buildArray( |
| 121 | description, |
| 122 | exampleInputs.length > 0 |
| 123 | ? `${pluralize(exampleInputs.length, 'Example')}:` |
| 124 | : '', |
| 125 | ...exampleInputs.map((example) => |
| 126 | getToolCallString(toolName, example, endsAgentStep), |
| 127 | ), |
| 128 | ).join('\n\n') |
| 129 | return buildArray([ |
| 130 | `### ${toolName}`, |
| 131 | schema.description || '', |
| 132 | paramsSection({ schema, endsAgentStep }), |
| 133 | descriptionWithExamples, |
| 134 | ]).join('\n\n') |
| 135 | } |
| 136 | |
| 137 | export const toolDescriptions = Object.fromEntries( |
| 138 | Object.entries(toolParams).map(([name, config]) => [ |
no test coverage detected