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
{{ message }}
Repository navigation
McpTool only supports returning text types, not image #68
Is your feature request related to a problem? Please describe.
I'm attempting to build out a .NET implementation of server-everything and one of the features is the Tiny Image Tool which returns a combination of text and image messages (https://github.com/modelcontextprotocol/servers/blob/e328131d99847e1eae33c7a6a8156fd217cf984f/src/everything/everything.ts#L460-L479). If you implement a McpTool method you are unable to return something that can have different content types, as the return value is always serialized to a content type of text.
Describe the solution you'd like
Some way in which you can return a different content type/collection of content types, without having to fallback to implementing a CallToolHandler.
Describe alternatives you've considered
Implementing as a CallToolHandler.
Just checking that this is now supported, as I couldn't grasp from #89 how to return different stuff from McpServerTool - is it a case of creating a Content object and returning that?
Activity
aaronpowell commentedon Mar 25, 2025
Just checking that this is now supported, as I couldn't grasp from #89 how to return different stuff from
McpServerTool- is it a case of creating aContentobject and returning that?stephentoub commentedon Mar 26, 2025
You can return a DataContent:
csharp-sdk/src/ModelContextProtocol/Server/AIFunctionMcpServerTool.cs
Lines 198 to 207 in 4b70bc7
and it'll be mapped either to "image" or "resource" based on its mime type.
We can augment this list with other types as well. I believe that's what #41 is tracking.
Contentmight be a good candidate.Adding support for returning collections from tools
Adding support for returning collections from tools (#116)