backstage icon indicating copy to clipboard operation
backstage copied to clipboard

chore(mcp): Handle all Backstage errors, both built-in and custom

Open johnmcollier opened this issue 5 months ago • 2 comments

Hey, I just made a Pull Request!

Follow up PR to https://github.com/backstage/backstage/pull/31847

This PR updates handleErrors.ts in mcp-actions-backend to handle any custom Backstage error, rather than just the built-in errors in @backstage/errors. This will be useful for any MCP tools that interact with plugins / custom integrations that have their own error set outside of the standard errors provided.

I've also added a couple basic test cases to cover the logic in handleErrors.ts

:heavy_check_mark: Checklist

  • [x] A changeset describing the change and affected packages. (more info)
  • [x] Added or updated documentation
  • [x] Tests for new functionality and regression tests for bug fixes
  • [ ] Screenshots attached (for UI changes)
  • [x] All your commits have a Signed-off-by line in the message. (more info)

johnmcollier avatar Nov 27 '25 18:11 johnmcollier

[!IMPORTANT] This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/errors packages/errors minor v1.2.7
@backstage/plugin-mcp-actions-backend plugins/mcp-actions-backend patch v0.1.6-next.1

backstage-goalie[bot] avatar Nov 27 '25 18:11 backstage-goalie[bot]

Example of custom error being thrown in an MCP action:

Screenshot 2025-11-27 at 1 29 15 PM

johnmcollier avatar Nov 27 '25 18:11 johnmcollier