MCPcopy
hub / github.com/subquery/subql / getMCPStructuredResponse

Function getMCPStructuredResponse

packages/cli/src/adapters/utils.ts:398–408  ·  view source on GitHub ↗
(
  result: z.ZodObject<T> | z.ZodArray<z.ZodObject<T>>
)

Source from the content-addressed store, hash-verified

396}
397
398export function getMCPStructuredResponse<T extends z.ZodRawShape>(
399 result: z.ZodObject<T> | z.ZodArray<z.ZodObject<T>>
400): z.ZodObject<{
401 result: z.ZodOptional<z.ZodObject<T> | z.ZodArray<z.ZodObject<T>>>;
402 error: z.ZodOptional<z.ZodString>;
403}> {
404 return z.object({
405 result: z.optional(result),
406 error: z.optional(z.string().describe('Error message if the command fails')),
407 });
408}
409
410/**
411 * Wraps a promise to provide a structured response for MCP tools including error handling.

Calls

no outgoing calls

Tested by

no test coverage detected