Resource Content / LLM Context Placement Hint #90
evalstate
started this conversation in
Ideas - General
Replies: 1 comment 7 replies
-
|
I agree it would be good to get some guidance in the spec. There is also:
Plus, as mentioned, the
Could you explain a bit more about how that would differ from the Also, if |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Your Idea
While MCP includes a Priority/Audience annotation, it would be nice to be able to have an explicit "Hint" to indicate whether a Resource is intended to be placed within LLM context or as an attachment.Edit: The Audience annotation on Resources does this - instead I think some guidance on this topic would be appropriate.
I do think it would make sense to allow the return of a "Resource Pointer" Server the option of returning a Resource without necessarily embedding in the response. Of course, the Server could simply list Resources in it's textual response, but I think this would be cleaner.
We should also distinguish between the intended difference of returning an ImageContent as part of the CallToolResult vs returning it an EmbeddedResource.
A common case for this distinction would be:
Although ultimately a Client handling decision, I think in a lot of cases the Client and/or Server would be able to provide a hint for the expected handling of a Resource.
While the protocol provides mechanisms like Roots and Resource Templates for organizing and accessing resources, it doesn't currently offer a straightforward way to communicate these handling preferences between Client and Server.
Some ideas:
Example Flows:
sequenceDiagram participant U as User participant C as Client participant L as LLM participant S as Server rect rgb(240, 240, 240) Note over U,S: Claude Desktop: Current Flow - All Images In Context U->>C: "Generate beach image" C->>L: Send prompt L->>C: Request tool 'generate_image' C->>S: tools/call Request S-->>C: Response with ImageContent C->>L: Include image in context C-->>U: Display image end rect rgb(230, 240, 250) Note over U,S: Desired Flow - Generated Images U->>C: "Generate beach image" C->>L: Send prompt L->>C: Request tool 'generate_image' C->>S: tools/call Request S-->>C: Response with ImageContent<br/>(hint: prefer-attachment) C-->>U: Display image Note over C: Image not added<br/>to LLM context C->>L: Continue conversation end rect rgb(230, 250, 240) Note over U,S: Desired Flow - Analysis Case (e.g. OCR) U->>C: "What's in this image?" C->>L: Send prompt L->>C: Request tool 'analyze_image' C->>S: tools/call Request S-->>C: Response with ImageContent<br/>(hint: prefer-context) C->>L: Include image in context L-->>C: Image analysis C-->>U: Display analysis endIn this example, the create_image tool has been hardcoded to generate beach scenes. Claude Desktop recognises the image is not as requested (and even retries!). This shows the Client incorporating the resource in to the Context Window.
Scope
Beta Was this translation helpful? Give feedback.
All reactions