Skip to content

[BUG] [v0.0.7] cortex-mcp-types SamplingResult accepts embedded resource content even though sampling results only allow text or image #53326

@marvinayisi

Description

@marvinayisi

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

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

Steps to Reproduce

  1. Create a tiny Rust crate depending on cortex-mcp-types from this workspace.
  2. Deserialize a SamplingResult whose content has type: "resource".
  3. 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

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