Skip to content

Support multiple tool responses and embedded resources #90

@JonathanWebNL

Description

@JonathanWebNL

Edit: This not only is a way to support MCP UI, but more importantly "Multiple content items of different types" and "Embedded Resources" are part of the MCP tool result spec.

In the current version, it looks like it is not possible to implement MCP UI (as opposed to OpenAI Apps SDK). MCP UI requires you return a text response as well as a resource. Here an example from the Shopify get_product_details tool (MCP URL: https://mcpstorefront.com/?store=demostore.mock.shop)

{
    "content": [
        {
            "type": "text",
            "text": "{\"product\":{...}},\"instructions\":\"Use markdown to render product titles as links to their respective product pages using the URL property.\\nPay attention to the selected variant specified in the response.\\n\"}"
        },
        {
            "type": "resource",
            "resource": {
                "uri": "ui://product/gid://shopify/Product/7983595290646",
                "mimeType": "text/uri-list",
                "text": "https://cdn.shopify.com/storefront/product.component?store_domain=demostore.mock.shop&inline=true&product_handle=black-sunnies"
            }
        }
    ],
    "isError": false
}

For what I have seen, it currently is not possible to return multiple responses, and it's also not possible to return resources from a tool.

I tried to make it work with a few extends but failed because of the way the CallTool is set up. I got it to work with OpenAI's App SDK, but it would be great if we could also implement MCP UI using this package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions