Handing off to AI
DevLens turns a failure into the evidence an AI coding agent needs: what failed, the error, the file and line, and the path that led there. Copy it into any agent, or let your agent fetch it itself.
Copy it into any agent
On a trace, Copy failing path for AI puts a ready-to-paste prompt on your clipboard: a short task, a one-sentence summary and the evidence as JSON. Paste it into Claude Code, Cursor, Copilot or a chat, then ask for a fix. Download JSON saves the same evidence as a file.
By default the export is the failing path (or every step, for a trace that didn't fail). To send only certain steps, Shift-click them in the graph; the button then says what it will copy, such as Copy 2 spans for AI. The shortcut is C.
What the evidence contains
{
"summary": "DemoUser.create (database) failed: P2002: Unique constraint failed … at apps/demo-app/services/registration.ts:14. Path: …",
"guide": { "task": "Find the root cause of this failure and propose a fix. …", "untrustedData": "…", "fields": { … } },
"traceId": "de300000000000000000000000000001",
"failure": {
"operation": "DemoUser.create",
"kind": "database",
"error": "P2002: Unique constraint failed on the constraint: `DemoUser_email_key`",
"source": "apps/demo-app/services/registration.ts:14"
},
"executionPath": ["Submit registration", "fetch POST /api/register", "POST /api/register", "…"],
"spans": [ { "name": "…", "kind": "…", "status": "error", "durationMs": 117, "httpStatus": 409 } ],
"evidence": { "totalDurationMs": 121, "spanCount": 5 }
}summary: one sentence, what failed and where.guide: fixed instructions written by DevLens, telling the agent its task and what each field means.failure: the root cause, its error and itsfile:line(plus a GitHub link when one can be built).executionPathandspans: every step on the path, with status, duration and HTTP status.
Only allowlisted fields leave DevLens: never request bodies, query arguments or raw attributes. Everything your app recorded is marked as evidence, not instructions, so text inside an error message can't steer the agent.
Let your agent fetch it (MCP)
DevLens includes an MCP server, so an agent can look up failures itself. Ask “What's failing in DevLens? Find the root cause.” and it lists the failing traces, fetches the evidence for one, opens the file and proposes a fix, with a link back to the graph. It works with any agent that supports local MCP servers: Claude Code, Cursor, VS Code, Windsurf, Claude Desktop and others.
- Open the project's Keys & settings and choose Create read token. Copy the token (
rt_…): it is shown once. - Make sure Node.js 20 or newer is installed. The server is the npm package
@devlenshq/mcp; your agent starts it withnpx, which downloads it the first time. There is nothing else to install. - Register it with your agent. Settings shows both forms with your token filled in.
claude mcp add devlens --env DEVLENS_URL=https://devlenshq.dev --env DEVLENS_READ_TOKEN=rt_… -- npx -y @devlenshq/mcp
{
"mcpServers": {
"devlens": {
"command": "npx",
"args": [
"-y",
"@devlenshq/mcp"
],
"env": {
"DEVLENS_URL": "https://devlenshq.dev",
"DEVLENS_READ_TOKEN": "rt_…"
}
}
}
}VS Code takes the same entry under "servers" in .vscode/mcp.json. Keep any file holding the token out of git.
| Tool | What the agent gets |
|---|---|
list_failed_traces | The newest failing traces, one line each, with a link to each graph. |
get_trace_context | The same evidence as the Copy button, headed by the trace's link. |
open_trace_in_browser | Opens the graph in your browser. Agents ask before using it. |
A read token can only read, and only its own project. Creating a new one stops the old one immediately. See Security and privacy.