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

Function paramsSection

packages/agent-runtime/src/tools/prompts.ts:77–103  ·  view source on GitHub ↗
(params: { schema: z.ZodType; endsAgentStep: boolean })

Source from the content-addressed store, hash-verified

75}
76
77function paramsSection(params: { schema: z.ZodType; endsAgentStep: boolean }) {
78 const { schema, endsAgentStep } = params
79 const safeSchema = ensureJsonSchemaCompatible(schema)
80 const schemaWithEndsAgentStepParam = endsAgentStep
81 ? safeSchema.and(
82 z.object({
83 [endsAgentStepParam]: z
84 .literal(endsAgentStep)
85 .describe('Easp flag must be set to true'),
86 }),
87 )
88 : safeSchema
89 const jsonSchema = toJsonSchemaSafe(schemaWithEndsAgentStepParam)
90 delete jsonSchema.description
91 delete jsonSchema['$schema']
92 const paramsDescription = hasMeaningfulJsonSchema(jsonSchema)
93 ? JSON.stringify(jsonSchema, null, 2)
94 : 'None'
95
96 let paramsSection = ''
97 if (paramsDescription.length === 1 && paramsDescription[0] === 'None') {
98 paramsSection = 'Params: None'
99 } else if (paramsDescription.length > 0) {
100 paramsSection = `Params: ${paramsDescription}`
101 }
102 return paramsSection
103}
104
105// Helper function to build the full tool description markdown
106export function buildToolDescription(params: {

Callers 2

buildToolDescriptionFunction · 0.85

Calls 3

toJsonSchemaSafeFunction · 0.85
hasMeaningfulJsonSchemaFunction · 0.85

Tested by

no test coverage detected