-
Notifications
You must be signed in to change notification settings - Fork 754
feat(mcp-instrumentation): Add error type to MCP errors. #3039
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
Conversation
Signed-off-by: fali007 <felixpv007@gmail.com>
Signed-off-by: felix <felix@felixs-MacBook-Pro.local>
felix seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
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.
Caution
Changes requested ❌
Reviewed everything up to c9cf00b in 2 minutes and 6 seconds. Click for details.
- Reviewed
280
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/opentelemetry-instrumentation-mcp/opentelemetry/instrumentation/mcp/instrumentation.py:180
- Draft comment:
Before accessing result.content[0].text, ensure that 'result.content' exists and is a non-empty list to avoid potential IndexError. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% This appears to be a reasonable defensive programming suggestion. The code assumes result.content exists and has at least one element when result.isError is true, but this may not always be guaranteed. An IndexError could occur if the error response has an unexpected structure. However, without seeing the full type definitions and API contract for the error responses, I can't be 100% certain this check is necessary. I don't have visibility into the API contract or type definitions that would tell me if result.content is guaranteed to exist and be non-empty when isError is true. The error handling may be following an established pattern. While defensive programming is good practice, without clear evidence that this check is necessary, I should err on the side of assuming the original author understood the API contract. Since I don't have strong evidence that this is a real issue rather than speculative, and understanding whether this check is needed would require more context about the API contract, I should remove this comment.
2. packages/opentelemetry-instrumentation-mcp/tests/test_mcp_instrumentation.py:149
- Draft comment:
No tests appear to cover error scenarios (e.g. when isError is true). Consider adding tests to validate that ERROR_TYPE and error statuses are correctly set in error cases. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_bwM8qaHTZpPAtOq9
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
packages/opentelemetry-instrumentation-mcp/opentelemetry/instrumentation/mcp/instrumentation.py
Outdated
Show resolved
Hide resolved
packages/opentelemetry-instrumentation-mcp/opentelemetry/instrumentation/mcp/instrumentation.py
Outdated
Show resolved
Hide resolved
…umentation/mcp/instrumentation.py Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Signed-off-by: fali007 <felixpv007@gmail.com>
Signed-off-by: fali007 <felixpv007@gmail.com>
Signed-off-by: fali007 <felixpv007@gmail.com>
Closing this PR because of CLA username issue. |
feat(instrumentation): ...
orfix(instrumentation): ...
.This PR aims to add error types and correct error messages to MCP errors propagated from MCP server to MCP client.
Important
Adds error type handling to MCP errors and updates tests for stream reader/writer classes.
traced_method
ininstrumentation.py
.get_error_type()
to extract HTTP error types from messages.traced_method
to setERROR_TYPE
attribute for errors.InstrumentedStreamWriter.send()
to handle error attributes.serialize()
and stream reader/writer classes intest_mcp_instrumentation.py
.InstrumentedStreamReader
andInstrumentedStreamWriter
for correct span attribute setting.This description was created by
for c9cf00b. You can customize this summary. It will automatically update as commits are pushed.