MCPcopy Create free account
hub / github.com/cloudflare/mcp / buildNonCodemodeTools

Function buildNonCodemodeTools

src/openapi.ts:186–208  ·  view source on GitHub ↗
(
  paths: Record<string, Record<string, OperationInfo>>
)

Source from the content-addressed store, hash-verified

184 * JSON Schema out of the request path.
185 */
186export function buildNonCodemodeTools(
187 paths: Record<string, Record<string, OperationInfo>>
188): NonCodemodeTool[] {
189 return listNonCodemodeOperations(paths).map(
190 ({ toolName, description, method, path, operation }) => ({
191 name: toolName,
192 title: toolNameToTitle(toolName),
193 description,
194 inputSchema: buildJsonInputSchema(operation, path),
195 method,
196 path,
197 queryParams: (operation.parameters ?? [])
198 .filter((parameter) => parameter.in === 'query')
199 .map((parameter) => parameter.name),
200 headerParams: (operation.parameters ?? [])
201 .filter((parameter) => parameter.in === 'header')
202 .map((parameter) => ({
203 name: parameter.name,
204 key: `header_${parameter.name.toLowerCase().replace(/-/g, '_')}`
205 }))
206 })
207 )
208}
209
210/** Rehydrate the small Zod shape required by the SDK's tools/call validation. */
211export function zodInputSchemaFromJson(

Callers 5

scheduledFunction · 0.90
getNonCodemodeToolsFunction · 0.90
seed-r2.tsFile · 0.90
seedSpecFunction · 0.90

Calls 4

toolNameToTitleFunction · 0.85
buildJsonInputSchemaFunction · 0.85
replaceMethod · 0.65

Tested by

no test coverage detected