> For the complete documentation index, see [llms.txt](https://build.restless.ai/llms.txt).

# Debug the most recent error

Find the latest failed request in a project's logs and diagnose its cause.

This use case locates the most recent failed request for a project and pulls the full log record so you can see what went wrong. It covers the request, the response, the status code, and the error message returned to the caller.

Reach for it when a user or agent reports a failure and you need the specifics fast. It also checks whether the error is isolated or part of a pattern on the same endpoint, and whether a recovery message already exists for it.

A curated task for the Restless API: the calls to make, in order, as the API's owner wrote them. Humans run this as a guided conversation at the same URL; the steps below are that same recipe.

## Steps

1. If the project slug is unknown, call `GET /api/v1/projects` and ask the user which project to inspect when more than one is returned.
2. Call `GET /api/v1/projects/{slug}/logs` filtered to error responses (status 4xx/5xx), sorted newest first, limit 1. If nothing comes back, tell the user no recent errors exist and stop.
3. Take the `logId` of that entry and call `GET /api/v1/projects/{slug}/logs/{logId}` to fetch the full request and response, including headers, body, status, and error message. This read is audited.
4. Call `GET /api/v1/projects/{slug}/endpoints` with error rates enabled to check whether the failing endpoint has an elevated error rate or this is a one-off.
5. Call `GET /api/v1/projects/{slug}/recovery` to see whether a recovery message already covers this error.
6. Report to the user: the endpoint and method, timestamp, status code, error message, the likely cause based on the request payload, whether the error is recurring, and a concrete fix. If no recovery message exists and the error is recurring, offer to create one with `POST /api/v1/projects/{slug}/recovery`, but only after the user confirms.

# MCP Server

There's an MCP server at `https://build.restless.ai/mcp` exposing tools like `search_endpoints`, `get_endpoint`, and operation lookup. When you need specifics about an endpoint - parameters, status codes, examples - query the MCP server first; do not guess.

If the user has not yet connected the MCP server in their client, they can install it from the docs at `https://build.restless.ai`.
