MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / hasMeaningfulJsonSchema

Function hasMeaningfulJsonSchema

packages/agent-runtime/src/tools/prompts.ts:56–75  ·  view source on GitHub ↗
(jsonSchema: Record<string, unknown>)

Source from the content-addressed store, hash-verified

54}
55
56function hasMeaningfulJsonSchema(jsonSchema: Record<string, unknown>): boolean {
57 const properties = jsonSchema.properties
58 if (properties && typeof properties === 'object' && Object.keys(properties).length > 0) {
59 return true
60 }
61
62 for (const key of ['allOf', 'anyOf', 'oneOf']) {
63 const value = jsonSchema[key]
64 if (Array.isArray(value) && value.length > 0) {
65 return true
66 }
67 }
68
69 const required = jsonSchema.required
70 if (Array.isArray(required) && required.length > 0) {
71 return true
72 }
73
74 return false
75}
76
77function paramsSection(params: { schema: z.ZodType; endsAgentStep: boolean }) {
78 const { schema, endsAgentStep } = params

Callers 1

paramsSectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected