Explore documentation
Bulk resolving errors using MCP tools
The Better Stack MCP server allows your AI coding agent to interact with your error data directly from your terminal.
This enables you to automate your debugging workflow, from fetching error details to creating pull requests and resolving the issues in Better Stack without opening the browser.
The entire workflow, from identifying an error to resolving it, can be handled by an AI agent in your terminal. This includes:
- Fetching error details and stack traces for an application.
- Finding related errors to be fixed together.
- Creating a feature branch and a pull request with the fix.
- Verifying that the fix has been deployed.
- Resolving the error and all its occurrences in Better Stack.
Try it out in 10 minutes
First, make sure you have an application sending errors to Better Stack, and and AI agent such as Claude Code with Better Stack MCP server integrated.
Step 1: List your errors
Navigate to your project's directory and ask your AI agent to list the current errors for your application.
Your agent will use the MCP tools to find the correct application based on your current directory and return a summary of the latest errors.
Step 2: Investigate the error
Pick an error from the list and ask your agent for its full details. You can also ask it to find related errors that can be fixed at the same time.
The agent will return the root cause of the issue, often with a suggested fix.
Step 3: Create a pull request
Once you have enough information, instruct your agent to create a new branch and open a pull request with a fix.
The agent will write the code and provide a link to the newly created pull request.
Step 4: Review and merge
This is a manual step. Open the pull request, review the proposed changes, test them locally to ensure the bug is fixed, and then merge the PR into your main branch.
Step 5: Resolve the issue in Better Stack
After merging the fix, pull the latest changes into your local branch. Then, you can ask your agent to confirm the fix is present and resolve the corresponding issue in Better Stack.
The agent will confirm the code changes and then use the MCP tools to mark the error and all its previous occurrences as Resolved in the Better Stack UI. You can repeat this process until all your application's errors are fixed.