MCPcopy Create free account
hub / github.com/freecodexyz/free-code / parseClassifierResponse

Function parseClassifierResponse

src/utils/permissions/classifierShared.ts:30–39  ·  view source on GitHub ↗
(
  toolUseBlock: Extract<BetaContentBlock, { type: 'tool_use' }>,
  schema: T,
)

Source from the content-addressed store, hash-verified

28 * Returns null if parsing fails.
29 */
30export function parseClassifierResponse<T extends z.ZodTypeAny>(
31 toolUseBlock: Extract<BetaContentBlock, { type: 'tool_use' }>,
32 schema: T,
33): z.infer<T> | null {
34 const parseResult = schema.safeParse(toolUseBlock.input)
35 if (!parseResult.success) {
36 return null
37 }
38 return parseResult.data
39}

Callers 1

classifyYoloActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected