Skip to content

fix: preserve MCP execution errors in SmolAgentsAdapter - #95

Open
Dedale-Project wants to merge 3 commits into
grll:mainfrom
Dedale-Project:fix/smolagents-mcp-iserror-94
Open

Dedale-Project wants to merge 3 commits into
grll:mainfrom
Dedale-Project:fix/smolagents-mcp-iserror-94

Conversation

@Dedale-Project

Copy link
Copy Markdown

An MCP tool returning isError=True and structuredContent={"results": []} currently looks like a successful empty lookup to SmolAgentsAdapter, and its text error details disappear.

Check execution status before extracting any content and raise MCPToolExecutionError in both adapter modes. The exception includes every non-empty text block and structured error details, and retains the full original CallToolResult for programmatic inspection. Successful text/JSON responses keep their behavior; valid structured-only responses now return their available payload. Update the server-validation test that previously expected an MCP error to be returned as ordinary text, and document the new exception.

Validation: Python 3.12.14 (Linux), MCPAdapt 0.1.20 / main at 538cd85, smolagents 1.26.0, MCP 1.30.0. Reproduced against the published 0.1.20 package and confirmed identical adapter source to the release tag. Thirty offline regression cases pass, including the native Tool call and ToolCallingAgent execution wrapper. Existing smolagents tests plus new regressions and modeling tests: 38 passed, 2 skipped (local SSE and optional audio). Existing subprocess tests used a temporary launcher for uv run python to use the pinned venv rather than resolve other project dependencies. Ruff 0.9.1 checks/format pass. Full multi-framework suite, Windows, and LLM execution were not tested; selected adapter coverage is 75%, not a claim of full-project 95% coverage.

Prepared with Codex. Affiliation: Remnant. All reproduction inputs are synthetic.

Fixes #94

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SmolAgentsAdapter structured_output=True drops isError and the error text

1 participant