PrepGenAICerts
← Back to Labs

Structured Error Response

tool design mcp✓Fill in Blank

Complete this MCP tool error response for a timeout when calling an external order tracking API. The response must communicate the failure type, whether it can be retried, and set the correct error flag.

// The order tracking API timed out after 5 seconds.
// Return a structured error response so the agent can decide how to recover.
return {
  content: [
    {
      type: "text",
      text: JSON.stringify({
        errorCategory: "",
        isRetryable: ,
        message: "Order tracking API timed out after 5000ms.",
        suggestedAction: "Retry the request or inform the customer of a brief delay.",
        context: { orderId: "#12345", timeoutMs: 5000 },
      }),
    },
  ],
  isError: ,
};
Next Exercise →

PrepGenAICerts is an independent exam-prep site. It is not affiliated with, endorsed by, or sponsored by Anthropic, PBC. Claude and Anthropic are trademarks of Anthropic, PBC. Exam details are taken from publicly available Anthropic and Pearson documentation. About PrepGenAICerts.