You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exception that comes from the _format_errors in the MCP tools _base .py file is ok; however, that exception is then caught in the StaticWorkbench (
) and is cast to a string (e.g. unhandled errors in a TaskGroup)
The return_value_as_string gets called and tries to iterate through the items in the above string and serialize them (return_value_as_string in McpToolAdapter class); since items are not TextContent or EmbeddedResource (they are chars), it returns '{}' for each character in the string, so the actual error that gets returned to the user looks like this:
#6482)
…ized properly
## Why are these changes needed?
The exceptions thrown by MCP server tools weren't being serialized
properly - the user would see `[{}, {}, ... {}]` instead of an actual
error/exception message.
## Related issue number
Fixes#6481
## Checks
- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
---------
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
What happened?
Describe the bug
The exception that comes from the
_format_errors
in the MCP tools _base .py file is ok; however, that exception is then caught in the StaticWorkbench (autogen/python/packages/autogen-core/src/autogen_core/tools/_static_workbench.py
Line 60 in eba05ae
unhandled errors in a TaskGroup
)The
return_value_as_string
gets called and tries to iterate through the items in the above string and serialize them (return_value_as_string
in McpToolAdapter class); since items are not TextContent or EmbeddedResource (they are chars), it returns '{}' for each character in the string, so the actual error that gets returned to the user looks like this:To Reproduce
Call an MCP server tool that throws an exception.
Expected behavior
An actual exception should be displayed, but we get:
Which packages was the bug in?
Python Extensions (autogen-ext)
AutoGen library version.
Python dev (main branch)
Other library version.
No response
Model used
No response
Model provider
None
Other model provider
No response
Python version
None
.NET version
None
Operating system
None
The text was updated successfully, but these errors were encountered: