Skip to content

fix(mcp): preserve resource link descriptors in tool output - #4420

Open
CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/mcp-resource-link-content
Open

CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/mcp-resource-link-content

Conversation

@CryoThrust

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT (main@5a315a9af)

Description

Fixes #4419.

A successful MCP tool response containing resource_link currently turns into [Unsupported content type: ResourceLink], discarding the resource URI. The pinned SDK already supports this content type.

Convert resource links into JSON text descriptors at their original content position. Preserve type, name, uri and available title, description, mimeType, size; do not fetch resources or expose server _meta or client annotations in model input. Existing text/media/embedded-resource conversion and opt-in result metadata remain unchanged. No SDK upgrade or public API change is needed.

Regressions cover full descriptors with Unicode/escaping, minimal non-HTTP references, mixed text/structured-content ordering, and the public McpTool.callAsync path with a metadata customizer. Both link metadata and result metadata stay out of the model-visible descriptor. EN/ZH guides explain that resource reading is a separate operation.

Verification

Two URI-preservation regressions fail on the unchanged base with no skips. The converter, tool and result-metadata suites pass 104 cases after the fix, with no failures/errors/skips.

On Java 17:

mvn -o -B -T1C clean verify

The full 114-module clean verification passed in 8:28: 13,493 tests, zero failures/errors, 221 skipped. Skipped provider/platform tests are not claimed as executed. Tests use SDK objects and mocked wrappers; no live MCP server or resource fetch is claimed.

Documentation checks passed from docs/: npm test, npm run validate, npm run broken-links.

Checklist

  • Code formatted with Spotless
  • Complete reactor verification passed (skipped tests disclosed above)
  • Javadoc conventions preserved; no public API added
  • Related English and Chinese documentation updated
  • Code is ready for review

@mintlify

mintlify Bot commented Nov 25, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 34db1e8.

Approve preview

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.

MCP resource_link tool results lose their URI during content conversion

1 participant