From 73cb345d1dbc54f2221322cb9b74d25e4d3b0f58 Mon Sep 17 00:00:00 2001 From: jokemanfire Date: Wed, 25 Jun 2025 20:43:53 +0800 Subject: [PATCH] chore: add update for test_message_schema --- crates/rmcp/tests/test_message_schema.rs | 76 +++++--- .../client_json_rpc_message_schema.json | 123 +++++++++++-- .../server_json_rpc_message_schema.json | 164 +++++++++++++++--- 3 files changed, 302 insertions(+), 61 deletions(-) diff --git a/crates/rmcp/tests/test_message_schema.rs b/crates/rmcp/tests/test_message_schema.rs index 71c21f8f..86e93657 100644 --- a/crates/rmcp/tests/test_message_schema.rs +++ b/crates/rmcp/tests/test_message_schema.rs @@ -2,39 +2,71 @@ mod tests { use rmcp::model::{ClientJsonRpcMessage, ServerJsonRpcMessage}; use schemars::schema_for; + fn compare_schemas(name: &str, actual: &str, expected_file: &str) { + let expected = match std::fs::read_to_string(expected_file) { + Ok(content) => content, + Err(e) => { + panic!( + "Failed to read expected schema file {}: {}", + expected_file, e + ); + } + }; + + let actual_json: serde_json::Value = + serde_json::from_str(actual).expect("Failed to parse actual schema as JSON"); + let expected_json: serde_json::Value = + serde_json::from_str(&expected).expect("Failed to parse expected schema as JSON"); + + if actual_json == expected_json { + println!("{} schema matches expected", name); + return; + } + + // Write current schema to file for comparison + let current_file = expected_file.replace(".json", "_current.json"); + std::fs::write(¤t_file, actual).expect("Failed to write current schema"); + + println!("{} schema differs from expected", name); + println!("Expected: {}", expected_file); + println!("Current: {}", current_file); + println!( + "Run 'diff {} {}' to see differences", + expected_file, current_file + ); + + // UPDATE_SCHEMA=1 cargo test -p rmcp --test test_message_schema --features="server client schemars" + if std::env::var("UPDATE_SCHEMA").is_ok() { + println!("UPDATE_SCHEMA is set, updating expected file"); + std::fs::write(expected_file, actual).expect("Failed to update expected schema file"); + println!("Updated {}", expected_file); + } else { + println!("Set UPDATE_SCHEMA=1 to auto-update expected schemas"); + panic!("Schema validation failed"); + } + } + #[test] fn test_client_json_rpc_message_schema() { let schema = schema_for!(ClientJsonRpcMessage); - let schema_str = serde_json::to_string_pretty(&schema).unwrap(); - let expected = std::fs::read_to_string( + let schema_str = serde_json::to_string_pretty(&schema).expect("Failed to serialize schema"); + + compare_schemas( + "ClientJsonRpcMessage", + &schema_str, "tests/test_message_schema/client_json_rpc_message_schema.json", - ) - .unwrap(); - - // Parse both strings to JSON values for more robust comparison - let schema_json: serde_json::Value = serde_json::from_str(&schema_str).unwrap(); - let expected_json: serde_json::Value = serde_json::from_str(&expected).unwrap(); - assert_eq!( - schema_json, expected_json, - "Schema generation for ClientJsonRpcMessage should match expected output" ); } #[test] fn test_server_json_rpc_message_schema() { let schema = schema_for!(ServerJsonRpcMessage); - let schema_str = serde_json::to_string_pretty(&schema).unwrap(); - let expected = std::fs::read_to_string( + let schema_str = serde_json::to_string_pretty(&schema).expect("Failed to serialize schema"); + + compare_schemas( + "ServerJsonRpcMessage", + &schema_str, "tests/test_message_schema/server_json_rpc_message_schema.json", - ) - .unwrap(); - - // Parse both strings to JSON values for more robust comparison - let schema_json: serde_json::Value = serde_json::from_str(&schema_str).unwrap(); - let expected_json: serde_json::Value = serde_json::from_str(&expected).unwrap(); - assert_eq!( - schema_json, expected_json, - "Schema generation for ServerJsonRpcMessage should match expected output" ); } } diff --git a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json index 81189407..652e2990 100644 --- a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json +++ b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json @@ -1,30 +1,53 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "JsonRpcMessage_for_ClientRequest_and_ClientResult_and_ClientNotification", + "description": "Represents any JSON-RPC message that can be sent or received.\n\nThis enum covers all possible message types in the JSON-RPC protocol: individual requests/responses, notifications, batch operations, and errors. It serves as the top-level message container for MCP communication.", "anyOf": [ { - "$ref": "#/definitions/JsonRpcRequest_for_ClientRequest" + "description": "A single request expecting a response", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcRequest_for_ClientRequest" + } + ] }, { - "$ref": "#/definitions/JsonRpcResponse_for_ClientResult" + "description": "A response to a previous request", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcResponse_for_ClientResult" + } + ] }, { - "$ref": "#/definitions/JsonRpcNotification_for_ClientNotification" + "description": "A one-way notification (no response expected)", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcNotification_for_ClientNotification" + } + ] }, { + "description": "Multiple requests sent together", "type": "array", "items": { "$ref": "#/definitions/JsonRpcBatchRequestItem_for_ClientRequest_and_ClientNotification" } }, { + "description": "Multiple responses sent together", "type": "array", "items": { "$ref": "#/definitions/JsonRpcBatchResponseItem_for_ClientResult" } }, { - "$ref": "#/definitions/JsonRpcError" + "description": "An error response", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcError" + } + ] } ], "definitions": { @@ -185,12 +208,14 @@ "const": "tools/call" }, "CallToolRequestParam": { + "description": "Parameters for calling a tool provided by an MCP server.\n\nContains the tool name and optional arguments needed to execute the tool operation.", "type": "object", "required": [ "name" ], "properties": { "arguments": { + "description": "Arguments to pass to the tool (must match the tool's input schema)", "type": [ "object", "null" @@ -198,6 +223,7 @@ "additionalProperties": true }, "name": { + "description": "The name of the tool to call", "type": "string" } } @@ -292,6 +318,7 @@ } }, "CreateMessageResult": { + "description": "The result of a sampling/createMessage request containing the generated response.\n\nThis structure contains the generated message along with metadata about how the generation was performed and why it stopped.", "type": "object", "required": [ "content", @@ -300,15 +327,27 @@ ], "properties": { "content": { - "$ref": "#/definitions/Annotated_for_RawContent" + "description": "The actual content of the message (text, image, etc.)", + "allOf": [ + { + "$ref": "#/definitions/Annotated_for_RawContent" + } + ] }, "model": { + "description": "The identifier of the model that generated the response", "type": "string" }, "role": { - "$ref": "#/definitions/Role" + "description": "The role of the message sender (User or Assistant)", + "allOf": [ + { + "$ref": "#/definitions/Role" + } + ] }, "stopReason": { + "description": "The reason why generation stopped (e.g., \"endTurn\", \"maxTokens\")", "type": [ "string", "null" @@ -317,10 +356,11 @@ } }, "EmptyObject": { + "description": "This is commonly used for representing empty objects in MCP messages.\n\nwithout returning any specific data.", "type": "object" }, "ErrorData": { - "description": "Error information for JSON-RPC error responses.", + "description": "Error information for JSON-RPC error responses.\n\nThis structure follows the JSON-RPC 2.0 specification for error reporting, providing a standardized way to communicate errors between clients and servers.", "type": "object", "required": [ "code", @@ -328,7 +368,7 @@ ], "properties": { "code": { - "description": "The error type that occurred.", + "description": "The error type that occurred (using standard JSON-RPC error codes)", "type": "integer", "format": "int32" }, @@ -347,6 +387,7 @@ "const": "prompts/get" }, "GetPromptRequestParam": { + "description": "Parameters for retrieving a specific prompt", "type": "object", "required": [ "name" @@ -380,6 +421,7 @@ } }, "InitializeRequestParam": { + "description": "Parameters sent by a client when initializing a connection to an MCP server.\n\nThis contains the client's protocol version, capabilities, and implementation information, allowing the server to understand what the client supports.", "type": "object", "required": [ "capabilities", @@ -388,13 +430,28 @@ ], "properties": { "capabilities": { - "$ref": "#/definitions/ClientCapabilities" + "description": "The capabilities this client supports (sampling, roots, etc.)", + "allOf": [ + { + "$ref": "#/definitions/ClientCapabilities" + } + ] }, "clientInfo": { - "$ref": "#/definitions/Implementation" + "description": "Information about the client implementation", + "allOf": [ + { + "$ref": "#/definitions/Implementation" + } + ] }, "protocolVersion": { - "$ref": "#/definitions/ProtocolVersion" + "description": "The MCP protocol version this client supports", + "allOf": [ + { + "$ref": "#/definitions/ProtocolVersion" + } + ] } } }, @@ -587,6 +644,7 @@ "const": "tools/list" }, "LoggingLevel": { + "description": "Logging levels supported by the MCP protocol", "type": "string", "enum": [ "debug", @@ -717,6 +775,7 @@ } }, "ProtocolVersion": { + "description": "Represents the MCP protocol version used for communication.\n\nThis ensures compatibility between clients and servers by specifying which version of the Model Context Protocol is being used.", "type": "string" }, "ReadResourceRequestMethod": { @@ -725,12 +784,14 @@ "const": "resources/read" }, "ReadResourceRequestParam": { + "description": "Parameters for reading a specific resource", "type": "object", "required": [ "uri" ], "properties": { "uri": { + "description": "The URI of the resource to read", "type": "string" } } @@ -871,6 +932,7 @@ } }, "Request_for_CallToolRequestMethod_and_CallToolRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -886,6 +948,7 @@ } }, "Request_for_CompleteRequestMethod_and_CompleteRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -901,6 +964,7 @@ } }, "Request_for_GetPromptRequestMethod_and_GetPromptRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -916,6 +980,7 @@ } }, "Request_for_InitializeResultMethod_and_InitializeRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -931,6 +996,7 @@ } }, "Request_for_ReadResourceRequestMethod_and_ReadResourceRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -946,6 +1012,7 @@ } }, "Request_for_SetLevelRequestMethod_and_SetLevelRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -961,6 +1028,7 @@ } }, "Request_for_SubscribeRequestMethod_and_SubscribeRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -976,6 +1044,7 @@ } }, "Request_for_UnsubscribeRequestMethod_and_UnsubscribeRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -1037,10 +1106,22 @@ ] }, "Role": { - "type": "string", - "enum": [ - "user", - "assistant" + "description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different types of message senders in the conversation flow.", + "oneOf": [ + { + "description": "A human user or client making a request", + "type": "string", + "enum": [ + "user" + ] + }, + { + "description": "An AI assistant or server providing a response", + "type": "string", + "enum": [ + "assistant" + ] + } ] }, "Root": { @@ -1082,13 +1163,19 @@ "const": "logging/setLevel" }, "SetLevelRequestParam": { + "description": "Parameters for setting the logging level", "type": "object", "required": [ "level" ], "properties": { "level": { - "$ref": "#/definitions/LoggingLevel" + "description": "The desired logging level", + "allOf": [ + { + "$ref": "#/definitions/LoggingLevel" + } + ] } } }, @@ -1098,12 +1185,14 @@ "const": "resources/subscribe" }, "SubscribeRequestParam": { + "description": "Parameters for subscribing to resource updates", "type": "object", "required": [ "uri" ], "properties": { "uri": { + "description": "The URI of the resource to subscribe to", "type": "string" } } @@ -1114,12 +1203,14 @@ "const": "resources/unsubscribe" }, "UnsubscribeRequestParam": { + "description": "Parameters for unsubscribing from resource updates", "type": "object", "required": [ "uri" ], "properties": { "uri": { + "description": "The URI of the resource to unsubscribe from", "type": "string" } } diff --git a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json index e0378db3..3535c73b 100644 --- a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json +++ b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json @@ -1,30 +1,53 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "JsonRpcMessage_for_ServerRequest_and_ServerResult_and_ServerNotification", + "description": "Represents any JSON-RPC message that can be sent or received.\n\nThis enum covers all possible message types in the JSON-RPC protocol: individual requests/responses, notifications, batch operations, and errors. It serves as the top-level message container for MCP communication.", "anyOf": [ { - "$ref": "#/definitions/JsonRpcRequest_for_ServerRequest" + "description": "A single request expecting a response", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcRequest_for_ServerRequest" + } + ] }, { - "$ref": "#/definitions/JsonRpcResponse_for_ServerResult" + "description": "A response to a previous request", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcResponse_for_ServerResult" + } + ] }, { - "$ref": "#/definitions/JsonRpcNotification_for_ServerNotification" + "description": "A one-way notification (no response expected)", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcNotification_for_ServerNotification" + } + ] }, { + "description": "Multiple requests sent together", "type": "array", "items": { "$ref": "#/definitions/JsonRpcBatchRequestItem_for_ServerRequest_and_ServerNotification" } }, { + "description": "Multiple responses sent together", "type": "array", "items": { "$ref": "#/definitions/JsonRpcBatchResponseItem_for_ServerResult" } }, { - "$ref": "#/definitions/JsonRpcError" + "description": "An error response", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcError" + } + ] } ], "definitions": { @@ -274,18 +297,21 @@ } }, "CallToolResult": { + "description": "The result of a tool call operation.\n\nContains the content returned by the tool execution and an optional flag indicating whether the operation resulted in an error.", "type": "object", "required": [ "content" ], "properties": { "content": { + "description": "The content returned by the tool (text, images, etc.)", "type": "array", "items": { "$ref": "#/definitions/Annotated_for_RawContent" } }, "isError": { + "description": "Whether this result represents an error condition", "type": [ "boolean", "null" @@ -355,11 +381,29 @@ } }, "ContextInclusion": { - "type": "string", - "enum": [ - "allServers", - "none", - "thisServer" + "description": "Specifies how much context should be included in sampling requests.\n\nThis allows clients to control what additional context information should be provided to the LLM when processing sampling requests.", + "oneOf": [ + { + "description": "Include context from all connected MCP servers", + "type": "string", + "enum": [ + "allServers" + ] + }, + { + "description": "Include no additional context", + "type": "string", + "enum": [ + "none" + ] + }, + { + "description": "Include context only from the requesting server", + "type": "string", + "enum": [ + "thisServer" + ] + } ] }, "CreateMessageRequestMethod": { @@ -368,6 +412,7 @@ "const": "sampling/createMessage" }, "CreateMessageRequestParam": { + "description": "Parameters for creating a message through LLM sampling.\n\nThis structure contains all the necessary information for a client to generate an LLM response, including conversation history, model preferences, and generation parameters.", "type": "object", "required": [ "maxTokens", @@ -375,6 +420,7 @@ ], "properties": { "includeContext": { + "description": "How much context to include from MCP servers", "anyOf": [ { "$ref": "#/definitions/ContextInclusion" @@ -385,18 +431,23 @@ ] }, "maxTokens": { + "description": "Maximum number of tokens to generate", "type": "integer", "format": "uint32", "minimum": 0.0 }, "messages": { + "description": "The conversation history and current messages", "type": "array", "items": { "$ref": "#/definitions/SamplingMessage" } }, - "metadata": true, + "metadata": { + "description": "Additional metadata for the request" + }, "modelPreferences": { + "description": "Preferences for model selection and behavior", "anyOf": [ { "$ref": "#/definitions/ModelPreferences" @@ -407,6 +458,7 @@ ] }, "stopSequences": { + "description": "Sequences that should stop generation", "type": [ "array", "null" @@ -416,12 +468,14 @@ } }, "systemPrompt": { + "description": "System prompt to guide the model's behavior", "type": [ "string", "null" ] }, "temperature": { + "description": "Temperature for controlling randomness (0.0 to 1.0)", "type": [ "number", "null" @@ -431,10 +485,11 @@ } }, "EmptyObject": { + "description": "This is commonly used for representing empty objects in MCP messages.\n\nwithout returning any specific data.", "type": "object" }, "ErrorData": { - "description": "Error information for JSON-RPC error responses.", + "description": "Error information for JSON-RPC error responses.\n\nThis structure follows the JSON-RPC 2.0 specification for error reporting, providing a standardized way to communicate errors between clients and servers.", "type": "object", "required": [ "code", @@ -442,7 +497,7 @@ ], "properties": { "code": { - "description": "The error type that occurred.", + "description": "The error type that occurred (using standard JSON-RPC error codes)", "type": "integer", "format": "int32" }, @@ -491,6 +546,7 @@ } }, "InitializeResult": { + "description": "The server's response to an initialization request.\n\nContains the server's protocol version, capabilities, and implementation information, along with optional instructions for the client.", "type": "object", "required": [ "capabilities", @@ -499,19 +555,35 @@ ], "properties": { "capabilities": { - "$ref": "#/definitions/ServerCapabilities" + "description": "The capabilities this server provides (tools, resources, prompts, etc.)", + "allOf": [ + { + "$ref": "#/definitions/ServerCapabilities" + } + ] }, "instructions": { + "description": "Optional human-readable instructions about using this server", "type": [ "string", "null" ] }, "protocolVersion": { - "$ref": "#/definitions/ProtocolVersion" + "description": "The MCP protocol version this server supports", + "allOf": [ + { + "$ref": "#/definitions/ProtocolVersion" + } + ] }, "serverInfo": { - "$ref": "#/definitions/Implementation" + "description": "Information about the server implementation", + "allOf": [ + { + "$ref": "#/definitions/Implementation" + } + ] } } }, @@ -724,6 +796,7 @@ } }, "LoggingLevel": { + "description": "Logging levels supported by the MCP protocol", "type": "string", "enum": [ "debug", @@ -742,17 +815,26 @@ "const": "notifications/message" }, "LoggingMessageNotificationParam": { + "description": "Parameters for a logging message notification", "type": "object", "required": [ "data", "level" ], "properties": { - "data": true, + "data": { + "description": "The actual log data" + }, "level": { - "$ref": "#/definitions/LoggingLevel" + "description": "The severity level of this log message", + "allOf": [ + { + "$ref": "#/definitions/LoggingLevel" + } + ] }, "logger": { + "description": "Optional logger name that generated this message", "type": [ "string", "null" @@ -761,9 +843,11 @@ } }, "ModelHint": { + "description": "A hint suggesting a preferred model name or family.\n\nModel hints are advisory suggestions that help clients choose appropriate models. They can be specific model names or general families like \"claude\" or \"gpt\".", "type": "object", "properties": { "name": { + "description": "The suggested model name or family identifier", "type": [ "string", "null" @@ -772,9 +856,11 @@ } }, "ModelPreferences": { + "description": "Preferences for model selection and behavior in sampling requests.\n\nThis allows servers to express their preferences for which model to use and how to balance different priorities when the client has multiple model options available.", "type": "object", "properties": { "costPriority": { + "description": "Priority for cost optimization (0.0 to 1.0, higher = prefer cheaper models)", "type": [ "number", "null" @@ -782,6 +868,7 @@ "format": "float" }, "hints": { + "description": "Specific model names or families to prefer (e.g., \"claude\", \"gpt\")", "type": [ "array", "null" @@ -791,6 +878,7 @@ } }, "intelligencePriority": { + "description": "Priority for intelligence/capability (0.0 to 1.0, higher = prefer more capable models)", "type": [ "number", "null" @@ -798,6 +886,7 @@ "format": "float" }, "speedPriority": { + "description": "Priority for speed/latency (0.0 to 1.0, higher = prefer faster models)", "type": [ "number", "null" @@ -1138,15 +1227,18 @@ } }, "ProtocolVersion": { + "description": "Represents the MCP protocol version used for communication.\n\nThis ensures compatibility between clients and servers by specifying which version of the Model Context Protocol is being used.", "type": "string" }, "ReadResourceResult": { + "description": "Result containing the contents of a read resource", "type": "object", "required": [ "contents" ], "properties": { "contents": { + "description": "The actual content of the resource", "type": "array", "items": { "$ref": "#/definitions/ResourceContents" @@ -1177,6 +1269,7 @@ } }, "Request_for_CreateMessageRequestMethod_and_CreateMessageRequestParam": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", "type": "object", "required": [ "method", @@ -1248,12 +1341,14 @@ "const": "notifications/resources/updated" }, "ResourceUpdatedNotificationParam": { + "description": "Parameters for a resource update notification", "type": "object", "required": [ "uri" ], "properties": { "uri": { + "description": "The URI of the resource that was updated", "type": "string" } } @@ -1276,13 +1371,26 @@ } }, "Role": { - "type": "string", - "enum": [ - "user", - "assistant" + "description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different types of message senders in the conversation flow.", + "oneOf": [ + { + "description": "A human user or client making a request", + "type": "string", + "enum": [ + "user" + ] + }, + { + "description": "An AI assistant or server providing a response", + "type": "string", + "enum": [ + "assistant" + ] + } ] }, "SamplingMessage": { + "description": "A message in a sampling conversation, containing a role and content.\n\nThis represents a single message in a conversation flow, used primarily in LLM sampling requests where the conversation history is important for generating appropriate responses.", "type": "object", "required": [ "content", @@ -1290,10 +1398,20 @@ ], "properties": { "content": { - "$ref": "#/definitions/Annotated_for_RawContent" + "description": "The actual content of the message (text, image, etc.)", + "allOf": [ + { + "$ref": "#/definitions/Annotated_for_RawContent" + } + ] }, "role": { - "$ref": "#/definitions/Role" + "description": "The role of the message sender (User or Assistant)", + "allOf": [ + { + "$ref": "#/definitions/Role" + } + ] } } },