( result: z.ZodObject<T> | z.ZodArray<z.ZodObject<T>> )
| 396 | } |
| 397 | |
| 398 | export 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. |
no outgoing calls
no test coverage detected