Skip to content

Add EmbeddedResource support to mcp #726

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KyMidd
Copy link

@KyMidd KyMidd commented Aug 22, 2025

Description

Hey team! Utilizing strands locally to connect to (remote github MCP), and saw that it was unable to download particular files using github MCP tool get_file_contents.

When I'd attempt I'd see logs like this:

2025-08-22 07:50:55,725 | INFO | Thread-1 (_background_task) | httpx | HTTP Request: POST https://api.githubcopilot.com/mcp/ "HTTP/1.1 200 OK"
2025-08-22 07:50:55,726 | DEBUG | Thread-1 (_background_task) | httpcore.http11 | receive_response_body.started request=<Request [b'POST']>
2025-08-22 07:50:55,853 | DEBUG | Thread-1 (_background_task) | httpcore.http11 | receive_response_body.complete
2025-08-22 07:50:55,854 | DEBUG | Thread-1 (_background_task) | httpcore.http11 | response_closed.started
2025-08-22 07:50:55,854 | DEBUG | Thread-1 (_background_task) | httpcore.http11 | response_closed.complete
2025-08-22 07:50:55,865 | DEBUG | MainThread | strands.tools.mcp.mcp_client | [Thread: MainThread, Session: 838664df-dafb-4a06-865e-91d618eb77f6] received tool result with 2 content items
2025-08-22 07:50:55,865 | DEBUG | MainThread | strands.tools.mcp.mcp_client | [Thread: MainThread, Session: 838664df-dafb-4a06-865e-91d618eb77f6] mapping MCP text content
2025-08-22 07:50:55,865 | DEBUG | MainThread | strands.tools.mcp.mcp_client | [Thread: MainThread, Session: 838664df-dafb-4a06-865e-91d618eb77f6] unhandled content type: EmbeddedResource - dropping content
2025-08-22 07:50:55,865 | DEBUG | MainThread | strands.tools.mcp.mcp_client | [Thread: MainThread, Session: 838664df-dafb-4a06-865e-91d618eb77f6] tool execution completed with status: success

The main issues appears to be that the file is not provided as text, it's provided as an EmbeddedResource. This PR provides Slack support for EmbeddedResources that match plaintext-readable types.

In my local testing, it fixes the behavior, and my strands agent can now read github files without any changes to the github MCP tools.

Related Issues

Partially fixes #535

  • Didn't attempt to add Audio content

Documentation PR

n/a

Type of Change

Bug fix

Testing

I made the changes to my local version of the sdk-python/src/strands/tools/mcp/mcp_client.py to add support for EmbeddedResource.

Here is my agent config file, it's an MVP of using github to fetch a file when I noticed it was unable to do so reliably.

When run, it is now able to fetch the file:

> python github_remote_mcp_with_PAT.py
User question: Fetch this file and print it: https://github.com/orgName/repoName/blob/branchName/path/fileName.tfvars

I'll fetch that file for you from the GitHub repository.
Tool #1: get_file_contents
Here's the content of the `fileName.tfvars` file:

```hcl
(file contents)
# ...
  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@KyMidd
Copy link
Author

KyMidd commented Aug 22, 2025

@notgitika, @pgrayy, @mehtarac - I saw ya'll have recently deployed PRs for testing - does anyone have time to approve this unit testing on this PR so I can make sure it ready for review? 🙏 Thanks in advance!

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.

[BUG] EmbeddedResource, Resource, Audio content type dropped in MCP tool results
1 participant