Skip to content

Conversation

@KyMidd
Copy link
Contributor

@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
Contributor 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!

@dbschmigelski dbschmigelski self-requested a review August 25, 2025 14:23
@dbschmigelski
Copy link
Member

Thanks for raising this. Left a few minor comments with the larger one being adding full resource support in one PR

Copy link
Contributor Author

@KyMidd KyMidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@zastrowm zastrowm added the area-mcp MCP related label Aug 25, 2025
@KyMidd KyMidd requested a review from dbschmigelski August 25, 2025 19:47
@KyMidd
Copy link
Contributor Author

KyMidd commented Sep 5, 2025

@dbschmigelski - Do you think it's possible to move this forward? Lacking the ability to read GitHub file contents is a pretty big miss, and I think resolving that is worth not packaging the entire support for Resources in a single PR. Please let me know your thoughts.

@dbschmigelski
Copy link
Member

@dbschmigelski - Do you think it's possible to move this forward? Lacking the ability to read GitHub file contents is a pretty big miss, and I think resolving that is worth not packaging the entire support for Resources in a single PR. Please let me know your thoughts.

Hi @KyMidd, very sorry for the delay on this. I think I am still hesitant to go forward without resources first being explored in Strands. This is mostly a fear of unknown unknowns. I do not know if there will be significant differences but I want to avoid getting stuck in a sub-optimal place because of backwards compatibility issues when I believe resources will not require much more beyond this PR. Resources is still on our roadmap, and we'll certainly move forward with embedded after that.

@KyMidd KyMidd changed the title Add EmbeddedResource support to mcp Add EmbeddedResource support to mcp (read GitHub file contents blocker) Sep 10, 2025
@KyMidd
Copy link
Contributor Author

KyMidd commented Sep 10, 2025

Hey @dbschmigelski, understood. I want to help if possible. Do you mean we should extend the EmbeddedResource support to also include binary/blob items, like images? I believe I know enough about the context and use case of these to support this, I'd just need to learn more about how binary files are stored and remembered (stored in memory? temporarily stored as binary files on disk?).

If you mean supporting Resources for list/changed, and subscription, I don't believe I know enough. Is that what you mean?

If so, how can I help? I can keep researching and iterating, or I could test out fixes when someone gets here from your team.

Thanks Dean, appreciate it.

@dbschmigelski
Copy link
Member

Hey @dbschmigelski, understood. I want to help if possible. Do you mean we should extend the EmbeddedResource support to also include binary/blob items, like images? I believe I know enough about the context and use case of these to support this, I'd just need to learn more about how binary files are stored and remembered (stored in memory? temporarily stored as binary files on disk?).

If you mean supporting Resources for list/changed, and subscription, I don't believe I know enough. Is that what you mean?

If so, how can I help? I can keep researching and iterating, or I could test out fixes when someone gets here from your team.

Thanks Dean, appreciate it.

Sorry, I mean supporting resources. But only list not changed or subscription. This would be almost the same as our prompt implementation which is not as "deep" in Strands as tools.

So it is a lot of boilerplate but in practice quite simple

  • list_resources_async
  • list_resources_sync
  • get_resource_sync
  • get_resources_async

I really just want to see if there is anything that we need to do which overlaps with what you proposed here. I honestly don't think it is much but prefer to have all of the data in front of us.

I can commit to getting looking at adding resources next week, raising the pr not necessarily merged or released, then we can compare if there is overlap here.

Sorry again for the delay

@KyMidd
Copy link
Contributor Author

KyMidd commented Sep 22, 2025

@dbschmigelski - Did you find any time to work on this last week? I'd love to compare when you get a chance :) Let me know if I should resolve the conflicts, I've done that once before but seems I should wait until we're closer.

@KyMidd KyMidd force-pushed the fix/mcp-embedded-resources branch from 914e9c8 to 8d7aa66 Compare September 22, 2025 19:49
@dbschmigelski dbschmigelski merged commit aada326 into strands-agents:main Oct 9, 2025
11 of 12 checks passed
@dbschmigelski
Copy link
Member

It took quite some time, but finally got this in @KyMidd. Thanks for the contribution!

@KyMidd KyMidd deleted the fix/mcp-embedded-resources branch October 10, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mcp MCP related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants