Skip to content

[BUG] [v0.0.7] cortex-mcp-types SamplingRequest accepts embedded resource content even though sampling messages only allow text or image #53325

@marvinayisi

Description

@marvinayisi

Project

cortex

Description

A sampling request whose message content is an embedded resource deserializes successfully into SamplingRequest, even though the 2024 MCP schema limits sampling messages to text or image content.

Error Message

SAMPLING_REQUEST_RESOURCE_PARSE=Ok(SamplingRequest { messages: [SamplingMessage { role: User, content: Resource { resource: ResourceContent { uri: "file:///tmp/demo.txt", mime_type: None, text: Some("hello"), blob: None } } }], model_preferences: None, system_prompt: None, include_context: None, temperature: None, max_tokens: Some(64), stop_sequences: None, metadata: None })

Debug Logs

N/A

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-request-resource-20260410-074112.png

Steps to Reproduce

  1. Create a tiny Rust crate depending on cortex-mcp-types from this workspace.
  2. Deserialize a SamplingRequest whose message content has type: "resource".
  3. Print the parse result.

Expected Behavior

The invalid sampling message content should be rejected.

Actual Behavior

Deserialization succeeds and produces a SamplingRequest 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 SamplingRequest resource content accepted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions