-
Notifications
You must be signed in to change notification settings - Fork 5
fix(mcp): harden tool output quality and coverage #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
90dc24d
8fccef8
d2699bc
459b16f
66737ad
43d614c
cb3e59e
c285883
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,7 +94,14 @@ export function instrumentMcpServer<TServer extends McpServer>( | |
|
|
||
| export function captureMcpException(error: unknown): void { | ||
| if (Sentry.isInitialized()) { | ||
| Sentry.captureException(error); | ||
| const safeError = new Error( | ||
| 'The Terminal49 upstream request could not be completed.', | ||
| ); | ||
| const name = error instanceof Error ? error.name : 'Error'; | ||
| safeError.name = /^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/.test(name) | ||
| ? name | ||
| : 'Error'; | ||
| Sentry.captureException(safeError); | ||
|
Comment on lines
+97
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replacing every exception with a newly constructed |
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
captureMcpExceptionreplaces every caught tool exception with a new genericError, so Sentry loses the original call-site stack and cause chain and groups distinct upstream failures at this sanitizer, making production incidents harder to diagnose.Knowledge Base Used: MCP Server Core (
@terminal49/mcp)Prompt To Fix With AI