Skip to content

Support MCP resources, multimodal, unstructured-* with integration tests#2918

Merged
afsalthaj merged 39 commits intomainfrom
resource_support
Mar 14, 2026
Merged

Support MCP resources, multimodal, unstructured-* with integration tests#2918
afsalthaj merged 39 commits intomainfrom
resource_support

Conversation

@afsalthaj
Copy link
Contributor

@afsalthaj afsalthaj commented Mar 3, 2026

Fixes #2795

Fixes #2863

Fixes #2794

Fixes #2822 (See #2961)

Also updated with #2980 (this required more testing and that took some time)

Note that, I am not doing any kebab case conversions to make things "look" good. I will do that separately, because it will hurt ongoing changes, and need a separate task for it. Things work without that now.

The whole MCP changes right now covers all features except prompt. It took a lot of re-iterations to make things work with MCP clients. OpenAI playground worked with tools but not with resources (because it didn't support).

Claude Desktop and MCP inspector are the new one I tested. Now I can see golem within Claude Desktop successfully. Claude Desktop actually helped with some real bugs.

Here is a screenshot of Claude configured with Golem (thought it was impossible until I came to know about https://www.npmjs.com/package/mcp-remote). Pasting the config here (might be helpful for docs)

In claude_desktop_config.json and restart desktop:

{
  "mcpServers": {
    "golem": {
      "command" : "npx",
      "args" : [ 
         "mcp-remote",
         "http://localhost:9007/mcp",
         "--header",
         "Host: localhost:9007",
         "--allow-http"
       
      ]
    }
  }
}
image image

These were not running for a major time of this PR in the draft state.

MCP inspector also works similar to Claude Desktop. Open AI doesn't because, they don't show options for resources.

I also tested resources, and MCP inspector is the best test that I could do, and it understood both resource template and concrete resource as mentioned in the MCP protocol.

Note

Also note that, everything in Golem doesn't have exact one to one with MCP as mentioned in the spec written by John. We are making the best approximations here. And whatever you see in this PR, has been manually tested with popular clients and making changes will need retesting.

I would also like to test more but only as part of release tests that will be done later. And as part of bug fixes.

Static Resource

It implies the resource is part of a cluster singleton

image

Template Resource

It implies resource depends on the identity of your agent

image image

These are tested with official MCP Inspector (the best client for testing), and invoked these tools. Before this PR, those images never existed

Multimodal - A weather report + weather image together

image

UnstructuredBinary: A snow fall image, given a city

Now it always render images, instead of at-times base64, or at times MCP client being smart and end up doing erroring out.

image

Unstrucured-Text report (there is nothing much here)

image

@afsalthaj afsalthaj changed the title support mcp resources Support MCP resources Mar 3, 2026
@afsalthaj afsalthaj changed the title Support MCP resources Support MCP resources, and other complex structures Mar 5, 2026
@afsalthaj afsalthaj marked this pull request as ready for review March 11, 2026 06:00
@afsalthaj afsalthaj changed the title Support MCP resources, and other complex structures Support MCP resources, multimodal, unstructured-* with integration tests Mar 11, 2026
feature = "full",
derive(IntoValue, FromValue, desert_rust::BinaryCodec)
)]
#[cfg_attr(feature = "full", derive(desert_rust::BinaryCodec))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this changed to manual implementation? Revert if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Automatic didn't work for functions that returned multimodal if I remember correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So just re-tested and yes I need this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain "did not work". We can fix the deriver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, WIT defines multimodal as list<tuple<string, element-value>>, and the actual runtime value is Value::Tuple. Not Value::Record.

What's in here is UntypedNamedElementValue {name, value} and the derive macro for FromVlaue will produce something that expects Value::Record.

So, ended up having Expected Record value with 2 fields, got Tuple([String("Text"), Variant { ... }]).

I think, its not a bug in the deriver to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing is untyped-named-element-value is used only in multimodal..No other wit types ends up being untyped-named-element-value.. so may be a rename will solve it, but i don't want to do that.

Also note that this is nothing related to MCP. Invoking a function that returns multimodal didn't work at all

@afsalthaj afsalthaj mentioned this pull request Mar 12, 2026
* implement prompt hints

* reformat code

* fix integration tests

* fix a bug related to validation of output schema in mcp inspector (#2969)
@afsalthaj
Copy link
Contributor Author

Also merged #2980 into this.

* implement prompt hints

* reformat code

* fix integration tests

* fix a bug related to validation of output schema in mcp inspector

* fix multimodal images

* make sure to render images

* Reformat code

* fix compilation errors and cleanup

* start fixing tests

* start fixing tests

* reformat code

* reformat code

* fix all unit tests
@afsalthaj afsalthaj merged commit 489e651 into main Mar 14, 2026
54 of 55 checks passed
@afsalthaj afsalthaj deleted the resource_support branch March 14, 2026 23:38
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants