Skip to content

structured_content validate: Error: Unexpected response type #355

@cougarwww

Description

@cougarwww

/// Validate that content and structured_content are mutually exclusive
pub fn validate(&self) -> Result<(), &'static str> {
match (&self.content, &self.structured_content) {
(Some(_), Some(_)) => Err("content and structured_content are mutually exclusive"),
(None, None) => Err("either content or structured_content must be provided"),
_ => Ok(()),
}
}

use python/fastmcp will return both content and structured_content

Result: 
 - CallToolResult {
    content: Some(
        [
            Annotated {
                raw: Text(
                    RawTextContent {
                        text: "2025-08-06 14:24:47",
                    },
                ),
                annotations: None,
            },
        ],
    ),
    structured_content: Some(
        Object {
            "result": String("2025-08-06 14:24:47"),
        },
    ),
    is_error: Some(
        false,
    ),
}

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