feat!: add MRTR model types (SEP-2322) (#915)
* feat!: add SEP-2322 MRTR model types * feat!: remove URLElicitationRequiredError (SEP-2322)
This commit is contained in:
parent
519577601d
commit
f4ff56b81d
7 changed files with 969 additions and 255 deletions
|
|
@ -1882,31 +1882,6 @@ async fn test_url_elicitation_json_rpc_protocol() {
|
|||
}
|
||||
}
|
||||
|
||||
/// Test ElicitationCompleteNotification serialization/deserialization
|
||||
#[tokio::test]
|
||||
async fn test_elicitation_completion_notification() {
|
||||
let notification_params = ElicitationResponseNotificationParam::new("elicit-789");
|
||||
|
||||
// Test serialization
|
||||
let json = serde_json::to_value(¬ification_params).unwrap();
|
||||
let expected = json!({
|
||||
"elicitationId": "elicit-789"
|
||||
});
|
||||
assert_eq!(json, expected);
|
||||
|
||||
// Test deserialization
|
||||
let deserialized: ElicitationResponseNotificationParam =
|
||||
serde_json::from_value(expected).unwrap();
|
||||
assert_eq!(deserialized.elicitation_id, "elicit-789");
|
||||
|
||||
// Test complete notification structure
|
||||
let notification = ElicitationCompleteNotification::new(notification_params);
|
||||
|
||||
let json = serde_json::to_value(¬ification).unwrap();
|
||||
assert_eq!(json["method"], "notifications/elicitation/complete");
|
||||
assert_eq!(json["params"]["elicitationId"], "elicit-789");
|
||||
}
|
||||
|
||||
/// Test UrlElicitationCapability structure and serialization
|
||||
#[tokio::test]
|
||||
async fn test_url_elicitation_capability() {
|
||||
|
|
@ -2020,39 +1995,6 @@ async fn test_elicitation_both_modes() {
|
|||
assert!(url_json.get("requestedSchema").is_none());
|
||||
}
|
||||
|
||||
/// Test URL_ELICITATION_REQUIRED error code
|
||||
#[tokio::test]
|
||||
async fn test_url_elicitation_required_error_code() {
|
||||
// Test the error code constant
|
||||
assert_eq!(ErrorCode::URL_ELICITATION_REQUIRED.0, -32042);
|
||||
|
||||
// Test creating error data with URL_ELICITATION_REQUIRED
|
||||
let error_data = ErrorData::url_elicitation_required(
|
||||
"URL elicitation is required for this operation",
|
||||
Some(json!({
|
||||
"url": "https://example.com/complete",
|
||||
"elicitationId": "elicit-999"
|
||||
})),
|
||||
);
|
||||
|
||||
assert_eq!(error_data.code, ErrorCode::URL_ELICITATION_REQUIRED);
|
||||
assert_eq!(
|
||||
error_data.message,
|
||||
"URL elicitation is required for this operation"
|
||||
);
|
||||
assert!(error_data.data.is_some());
|
||||
|
||||
// Test serialization
|
||||
let json = serde_json::to_value(&error_data).unwrap();
|
||||
assert_eq!(json["code"], -32042);
|
||||
assert_eq!(
|
||||
json["message"],
|
||||
"URL elicitation is required for this operation"
|
||||
);
|
||||
assert_eq!(json["data"]["url"], "https://example.com/complete");
|
||||
assert_eq!(json["data"]["elicitationId"], "elicit-999");
|
||||
}
|
||||
|
||||
/// Test ClientCapabilities with different elicitation mode combinations
|
||||
#[tokio::test]
|
||||
async fn test_client_capabilities_elicitation_modes() {
|
||||
|
|
@ -2102,32 +2044,6 @@ async fn test_client_capabilities_elicitation_modes() {
|
|||
assert!(json["elicitation"]["url"].is_object());
|
||||
}
|
||||
|
||||
/// Test ElicitationCompleteNotification in ServerNotification enum
|
||||
#[tokio::test]
|
||||
async fn test_elicitation_completion_in_server_notification() {
|
||||
let notification_param = ElicitationResponseNotificationParam::new("notify-123");
|
||||
|
||||
let completion_notification = ElicitationCompleteNotification::new(notification_param.clone());
|
||||
|
||||
// Test that it's part of ServerNotification
|
||||
let server_notification =
|
||||
ServerNotification::ElicitationCompleteNotification(completion_notification);
|
||||
|
||||
// Test serialization
|
||||
let json = serde_json::to_value(&server_notification).unwrap();
|
||||
assert_eq!(json["method"], "notifications/elicitation/complete");
|
||||
assert_eq!(json["params"]["elicitationId"], "notify-123");
|
||||
|
||||
// Test deserialization
|
||||
let deserialized: ServerNotification = serde_json::from_value(json).unwrap();
|
||||
match deserialized {
|
||||
ServerNotification::ElicitationCompleteNotification(notif) => {
|
||||
assert_eq!(notif.params.elicitation_id, "notify-123");
|
||||
}
|
||||
_ => panic!("Expected ElicitationCompleteNotification variant"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Test ElicitationAction with URL elicitation workflow
|
||||
#[tokio::test]
|
||||
async fn test_url_elicitation_action_workflow() {
|
||||
|
|
@ -2161,10 +2077,4 @@ async fn test_elicitation_method_constants() {
|
|||
ElicitationResponseNotificationMethod::VALUE,
|
||||
"notifications/elicitation/response"
|
||||
);
|
||||
|
||||
// Test new completion notification method
|
||||
assert_eq!(
|
||||
ElicitationCompletionNotificationMethod::VALUE,
|
||||
"notifications/elicitation/complete"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"result": {
|
||||
"resultType": "complete",
|
||||
"tools": [
|
||||
{
|
||||
"name": "add",
|
||||
|
|
|
|||
|
|
@ -143,10 +143,25 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputResponses": {
|
||||
"description": "Client responses to server-initiated input requests from a previous\n[`InputRequiredResult`]. Present only when retrying after an incomplete result.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the tool to call",
|
||||
"type": "string"
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state echoed back from a previous [`InputRequiredResult`].\nClients MUST return this value exactly as received.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"task": {
|
||||
"description": "Task metadata for async task management (SEP-1319)",
|
||||
"anyOf": [
|
||||
|
|
@ -726,8 +741,23 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputResponses": {
|
||||
"description": "Client responses to server-initiated input requests from a previous\n[`InputRequiredResult`].",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state echoed back from a previous [`InputRequiredResult`].",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1374,6 +1404,21 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputResponses": {
|
||||
"description": "Client responses to server-initiated input requests from a previous\n[`InputRequiredResult`].",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state echoed back from a previous [`InputRequiredResult`].",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"uri": {
|
||||
"description": "The URI of the resource to read",
|
||||
"type": "string"
|
||||
|
|
|
|||
|
|
@ -143,10 +143,25 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputResponses": {
|
||||
"description": "Client responses to server-initiated input requests from a previous\n[`InputRequiredResult`]. Present only when retrying after an incomplete result.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the tool to call",
|
||||
"type": "string"
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state echoed back from a previous [`InputRequiredResult`].\nClients MUST return this value exactly as received.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"task": {
|
||||
"description": "Task metadata for async task management (SEP-1319)",
|
||||
"anyOf": [
|
||||
|
|
@ -726,8 +741,23 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputResponses": {
|
||||
"description": "Client responses to server-initiated input requests from a previous\n[`InputRequiredResult`].",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state echoed back from a previous [`InputRequiredResult`].",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1374,6 +1404,21 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputResponses": {
|
||||
"description": "Client responses to server-initiated input requests from a previous\n[`InputRequiredResult`].",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state echoed back from a previous [`InputRequiredResult`].",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"uri": {
|
||||
"description": "The URI of the resource to read",
|
||||
"type": "string"
|
||||
|
|
|
|||
|
|
@ -178,6 +178,15 @@
|
|||
"null"
|
||||
]
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
},
|
||||
"structuredContent": {
|
||||
"description": "An optional JSON object that represents the structured result of the tool call"
|
||||
}
|
||||
|
|
@ -292,6 +301,15 @@
|
|||
},
|
||||
"completion": {
|
||||
"$ref": "#/definitions/CompletionInfo"
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -752,35 +770,11 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"ElicitationCompletionNotificationMethod": {
|
||||
"type": "string",
|
||||
"format": "const",
|
||||
"const": "notifications/elicitation/complete"
|
||||
},
|
||||
"ElicitationCreateRequestMethod": {
|
||||
"type": "string",
|
||||
"format": "const",
|
||||
"const": "elicitation/create"
|
||||
},
|
||||
"ElicitationResponseNotificationParam": {
|
||||
"description": "Notification parameters for an url elicitation completion notification.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_meta": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"elicitationId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"elicitationId"
|
||||
]
|
||||
},
|
||||
"ElicitationSchema": {
|
||||
"description": "Type-safe elicitation schema for requesting structured user input.\n\nThis enforces the MCP 2025-06-18 specification that elicitation schemas\nmust be objects with primitive-typed properties.\n\n# Example\n\n```rust\nuse rmcp::model::*;\n\nlet schema = ElicitationSchema::builder()\n .required_email(\"email\")\n .required_integer(\"age\", 0, 150)\n .optional_bool(\"newsletter\", false)\n .build();\n```",
|
||||
"type": "object",
|
||||
|
|
@ -948,6 +942,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/PromptMessage"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1205,6 +1208,77 @@
|
|||
"serverInfo"
|
||||
]
|
||||
},
|
||||
"InputRequest": {
|
||||
"description": "A server-initiated request that can appear inside [`InputRequests`].\n\nPer the MCP spec, only `CreateMessageRequest` (sampling),\n`ElicitRequest` (elicitation), and `ListRootsRequest` (roots)\nare allowed. This is modeled as an untagged enum rather than a\n`ServerRequest` alias to prevent `PingRequest` or `CustomRequest` from\nbeing included.",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "A `sampling/createMessage` request.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Request"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "An `elicitation/create` request.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Request2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A `roots/list` request.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestNoParam2"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"InputRequiredResult": {
|
||||
"description": "A result indicating that additional input is needed before the request\ncan be completed.\n\nAt least one of [`input_requests`](Self::input_requests) or\n[`request_state`](Self::request_state) MUST be present.\n\nServers MAY send this in response to `tools/call`, `prompts/get`, or\n`resources/read`. Servers MUST NOT send this for any other request.\n\n# Examples\n\n```\nuse rmcp::model::InputRequiredResult;\n\nlet result = InputRequiredResult::from_request_state(\"opaque-server-state\");\nassert!(result.input_requests.is_none());\nassert_eq!(result.request_state.as_deref(), Some(\"opaque-server-state\"));\n```",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_meta": {
|
||||
"description": "Optional protocol-level metadata.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputRequests": {
|
||||
"description": "Server-initiated requests that the client must fulfill before retrying.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/InputRequest"
|
||||
}
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state to be echoed back by the client on retry.\nClients MUST NOT inspect, parse, modify, or make any assumptions\nabout the contents.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Always `\"input_required\"` for this result type.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"resultType"
|
||||
]
|
||||
},
|
||||
"IntegerSchema": {
|
||||
"description": "Schema definition for integer properties.\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec.",
|
||||
"type": "object",
|
||||
|
|
@ -1322,9 +1396,6 @@
|
|||
{
|
||||
"$ref": "#/definitions/Notification5"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/Notification6"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/CustomNotification"
|
||||
}
|
||||
|
|
@ -1456,6 +1527,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/Prompt"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1483,6 +1563,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/ResourceTemplate"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1510,6 +1599,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/Resource"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1564,6 +1662,15 @@
|
|||
"null"
|
||||
]
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
},
|
||||
"tools": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -1758,21 +1865,6 @@
|
|||
]
|
||||
},
|
||||
"Notification5": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"method": {
|
||||
"$ref": "#/definitions/ElicitationCompletionNotificationMethod"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/ElicitationResponseNotificationParam"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"method",
|
||||
"params"
|
||||
]
|
||||
},
|
||||
"Notification6": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"method": {
|
||||
|
|
@ -2129,6 +2221,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/ResourceContents"
|
||||
}
|
||||
},
|
||||
"result_type": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -2442,6 +2543,10 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ResultType": {
|
||||
"description": "Indicates the type of a result object, allowing the client to\ndetermine how to parse the response.\n\nThe spec defines this as an open string (`\"complete\" | \"input_required\" | string`),\nso unknown values are preserved rather than rejected. Servers implementing this\nprotocol version MUST include `resultType` in every result. For backward\ncompatibility, clients MUST treat an absent field as `\"complete\"`.",
|
||||
"type": "string"
|
||||
},
|
||||
"Role": {
|
||||
"description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different\ntypes of message senders in the conversation flow.",
|
||||
"oneOf": [
|
||||
|
|
@ -2738,6 +2843,9 @@
|
|||
{
|
||||
"$ref": "#/definitions/CallToolResult"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/InputRequiredResult"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/GetTaskPayloadResult"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -178,6 +178,15 @@
|
|||
"null"
|
||||
]
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
},
|
||||
"structuredContent": {
|
||||
"description": "An optional JSON object that represents the structured result of the tool call"
|
||||
}
|
||||
|
|
@ -292,6 +301,15 @@
|
|||
},
|
||||
"completion": {
|
||||
"$ref": "#/definitions/CompletionInfo"
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -752,35 +770,11 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"ElicitationCompletionNotificationMethod": {
|
||||
"type": "string",
|
||||
"format": "const",
|
||||
"const": "notifications/elicitation/complete"
|
||||
},
|
||||
"ElicitationCreateRequestMethod": {
|
||||
"type": "string",
|
||||
"format": "const",
|
||||
"const": "elicitation/create"
|
||||
},
|
||||
"ElicitationResponseNotificationParam": {
|
||||
"description": "Notification parameters for an url elicitation completion notification.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_meta": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"elicitationId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"elicitationId"
|
||||
]
|
||||
},
|
||||
"ElicitationSchema": {
|
||||
"description": "Type-safe elicitation schema for requesting structured user input.\n\nThis enforces the MCP 2025-06-18 specification that elicitation schemas\nmust be objects with primitive-typed properties.\n\n# Example\n\n```rust\nuse rmcp::model::*;\n\nlet schema = ElicitationSchema::builder()\n .required_email(\"email\")\n .required_integer(\"age\", 0, 150)\n .optional_bool(\"newsletter\", false)\n .build();\n```",
|
||||
"type": "object",
|
||||
|
|
@ -948,6 +942,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/PromptMessage"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1205,6 +1208,77 @@
|
|||
"serverInfo"
|
||||
]
|
||||
},
|
||||
"InputRequest": {
|
||||
"description": "A server-initiated request that can appear inside [`InputRequests`].\n\nPer the MCP spec, only `CreateMessageRequest` (sampling),\n`ElicitRequest` (elicitation), and `ListRootsRequest` (roots)\nare allowed. This is modeled as an untagged enum rather than a\n`ServerRequest` alias to prevent `PingRequest` or `CustomRequest` from\nbeing included.",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "A `sampling/createMessage` request.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Request"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "An `elicitation/create` request.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Request2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A `roots/list` request.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestNoParam2"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"InputRequiredResult": {
|
||||
"description": "A result indicating that additional input is needed before the request\ncan be completed.\n\nAt least one of [`input_requests`](Self::input_requests) or\n[`request_state`](Self::request_state) MUST be present.\n\nServers MAY send this in response to `tools/call`, `prompts/get`, or\n`resources/read`. Servers MUST NOT send this for any other request.\n\n# Examples\n\n```\nuse rmcp::model::InputRequiredResult;\n\nlet result = InputRequiredResult::from_request_state(\"opaque-server-state\");\nassert!(result.input_requests.is_none());\nassert_eq!(result.request_state.as_deref(), Some(\"opaque-server-state\"));\n```",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_meta": {
|
||||
"description": "Optional protocol-level metadata.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"inputRequests": {
|
||||
"description": "Server-initiated requests that the client must fulfill before retrying.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/InputRequest"
|
||||
}
|
||||
},
|
||||
"requestState": {
|
||||
"description": "Opaque request state to be echoed back by the client on retry.\nClients MUST NOT inspect, parse, modify, or make any assumptions\nabout the contents.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Always `\"input_required\"` for this result type.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"resultType"
|
||||
]
|
||||
},
|
||||
"IntegerSchema": {
|
||||
"description": "Schema definition for integer properties.\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec.",
|
||||
"type": "object",
|
||||
|
|
@ -1322,9 +1396,6 @@
|
|||
{
|
||||
"$ref": "#/definitions/Notification5"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/Notification6"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/CustomNotification"
|
||||
}
|
||||
|
|
@ -1456,6 +1527,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/Prompt"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1483,6 +1563,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/ResourceTemplate"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1510,6 +1599,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/Resource"
|
||||
}
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -1564,6 +1662,15 @@
|
|||
"null"
|
||||
]
|
||||
},
|
||||
"resultType": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
},
|
||||
"tools": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -1758,21 +1865,6 @@
|
|||
]
|
||||
},
|
||||
"Notification5": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"method": {
|
||||
"$ref": "#/definitions/ElicitationCompletionNotificationMethod"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/ElicitationResponseNotificationParam"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"method",
|
||||
"params"
|
||||
]
|
||||
},
|
||||
"Notification6": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"method": {
|
||||
|
|
@ -2129,6 +2221,15 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/ResourceContents"
|
||||
}
|
||||
},
|
||||
"result_type": {
|
||||
"description": "Result type discriminator. Absent values deserialize as `\"complete\"`.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResultType"
|
||||
}
|
||||
],
|
||||
"default": "complete"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -2442,6 +2543,10 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ResultType": {
|
||||
"description": "Indicates the type of a result object, allowing the client to\ndetermine how to parse the response.\n\nThe spec defines this as an open string (`\"complete\" | \"input_required\" | string`),\nso unknown values are preserved rather than rejected. Servers implementing this\nprotocol version MUST include `resultType` in every result. For backward\ncompatibility, clients MUST treat an absent field as `\"complete\"`.",
|
||||
"type": "string"
|
||||
},
|
||||
"Role": {
|
||||
"description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different\ntypes of message senders in the conversation flow.",
|
||||
"oneOf": [
|
||||
|
|
@ -2738,6 +2843,9 @@
|
|||
{
|
||||
"$ref": "#/definitions/CallToolResult"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/InputRequiredResult"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/GetTaskPayloadResult"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ fn serialize_tool_result_with_meta() {
|
|||
let result = CallToolResult::success(content).with_meta(Some(meta));
|
||||
let v = serde_json::to_value(&result).unwrap();
|
||||
let expected = json!({
|
||||
"resultType": "complete",
|
||||
"content": [{"type":"text","text":"ok"}],
|
||||
"isError": false,
|
||||
"_meta": {"foo":"bar"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue