Project
cortex
Description
A sampling result whose content is an embedded resource deserializes successfully into SamplingResult, even though the 2024 MCP schema limits sampling results to text or image content.
Error Message
SAMPLING_RESULT_RESOURCE_PARSE=Ok(SamplingResult { model: "demo-model", stop_reason: None, role: Assistant, content: Resource { resource: ResourceContent { uri: "file:///tmp/demo.txt", mime_type: None, text: Some("hello"), blob: None } } })
Debug Logs
System Information
Cortex crate: cortex-mcp-types 0.0.7
Commit: 7954d02
Date: 2026-04-10
OS: macOS
Screenshots
https://github.com/marvinayisi/issue-images/blob/main/mcp-sampling-result-resource-20260410-074112.png
Steps to Reproduce
- Create a tiny Rust crate depending on
cortex-mcp-types from this workspace.
- Deserialize a
SamplingResult whose content has type: "resource".
- Print the parse result.
Expected Behavior
The invalid sampling result content should be rejected.
Actual Behavior
Deserialization succeeds and produces a SamplingResult containing resource content.
Additional Context
- Authoritative spec:
https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/2024-11-05/schema.ts
- Code path:
/Users/odeili/Projects/platform/cortex/src/cortex-mcp-types/src/sampling.rs
- Duplicate check on 2026-04-10:
cortex-mcp-types SamplingResult resource content accepted
Project
cortex
Description
A sampling result whose content is an embedded resource deserializes successfully into
SamplingResult, even though the 2024 MCP schema limits sampling results to text or image content.Error Message
Debug Logs
System Information
Screenshots
https://github.com/marvinayisi/issue-images/blob/main/mcp-sampling-result-resource-20260410-074112.png
Steps to Reproduce
cortex-mcp-typesfrom this workspace.SamplingResultwhose content hastype: "resource".Expected Behavior
The invalid sampling result content should be rejected.
Actual Behavior
Deserialization succeeds and produces a
SamplingResultcontaining resource content.Additional Context
https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/2024-11-05/schema.ts/Users/odeili/Projects/platform/cortex/src/cortex-mcp-types/src/sampling.rscortex-mcp-types SamplingResult resource content accepted