chore: add TS annotation to generated mcp-types (#2424)
Adds the `TS` annotation from https://crates.io/crates/ts-rs to all types to facilitate codegen. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2424). * __->__ #2424 * #2423
This commit is contained in:
33
codex-rs/Cargo.lock
generated
33
codex-rs/Cargo.lock
generated
@@ -2776,6 +2776,7 @@ version = "0.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"ts-rs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4707,6 +4708,15 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "termcolor"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "terminal_size"
|
name = "terminal_size"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
@@ -5206,6 +5216,29 @@ version = "0.2.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ts-rs"
|
||||||
|
version = "11.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be"
|
||||||
|
dependencies = [
|
||||||
|
"serde_json",
|
||||||
|
"thiserror 2.0.12",
|
||||||
|
"ts-rs-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ts-rs-macros"
|
||||||
|
version = "11.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e9d4ed7b4c18cc150a6a0a1e9ea1ecfa688791220781af6e119f9599a8502a0a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.104",
|
||||||
|
"termcolor",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tui-input"
|
name = "tui-input"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
ts-rs = { version = "11", features = ["serde-json-impl"] }
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ from typing import Any, Literal
|
|||||||
SCHEMA_VERSION = "2025-06-18"
|
SCHEMA_VERSION = "2025-06-18"
|
||||||
JSONRPC_VERSION = "2.0"
|
JSONRPC_VERSION = "2.0"
|
||||||
|
|
||||||
STANDARD_DERIVE = "#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]\n"
|
STANDARD_DERIVE = "#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]\n"
|
||||||
STANDARD_HASHABLE_DERIVE = (
|
STANDARD_HASHABLE_DERIVE = (
|
||||||
"#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq)]\n"
|
"#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq, TS)]\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Will be populated with the schema's `definitions` map in `main()` so that
|
# Will be populated with the schema's `definitions` map in `main()` so that
|
||||||
@@ -75,6 +75,8 @@ use serde::Serialize;
|
|||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
use ts_rs::TS;
|
||||||
|
|
||||||
pub const MCP_SCHEMA_VERSION: &str = "{SCHEMA_VERSION}";
|
pub const MCP_SCHEMA_VERSION: &str = "{SCHEMA_VERSION}";
|
||||||
pub const JSONRPC_VERSION: &str = "{JSONRPC_VERSION}";
|
pub const JSONRPC_VERSION: &str = "{JSONRPC_VERSION}";
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ use serde::Serialize;
|
|||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
use ts_rs::TS;
|
||||||
|
|
||||||
pub const MCP_SCHEMA_VERSION: &str = "2025-06-18";
|
pub const MCP_SCHEMA_VERSION: &str = "2025-06-18";
|
||||||
pub const JSONRPC_VERSION: &str = "2.0";
|
pub const JSONRPC_VERSION: &str = "2.0";
|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ fn default_jsonrpc() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
|
/// Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Annotations {
|
pub struct Annotations {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub audience: Option<Vec<Role>>,
|
pub audience: Option<Vec<Role>>,
|
||||||
@@ -46,7 +48,7 @@ pub struct Annotations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Audio provided to or from an LLM.
|
/// Audio provided to or from an LLM.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct AudioContent {
|
pub struct AudioContent {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -57,14 +59,14 @@ pub struct AudioContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Base interface for metadata with name (identifier) and title (display name) properties.
|
/// Base interface for metadata with name (identifier) and title (display name) properties.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct BaseMetadata {
|
pub struct BaseMetadata {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct BlobResourceContents {
|
pub struct BlobResourceContents {
|
||||||
pub blob: String,
|
pub blob: String,
|
||||||
#[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -72,7 +74,7 @@ pub struct BlobResourceContents {
|
|||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct BooleanSchema {
|
pub struct BooleanSchema {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub default: Option<bool>,
|
pub default: Option<bool>,
|
||||||
@@ -83,7 +85,7 @@ pub struct BooleanSchema {
|
|||||||
pub r#type: String, // &'static str = "boolean"
|
pub r#type: String, // &'static str = "boolean"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum CallToolRequest {}
|
pub enum CallToolRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for CallToolRequest {
|
impl ModelContextProtocolRequest for CallToolRequest {
|
||||||
@@ -92,7 +94,7 @@ impl ModelContextProtocolRequest for CallToolRequest {
|
|||||||
type Result = CallToolResult;
|
type Result = CallToolResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CallToolRequestParams {
|
pub struct CallToolRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub arguments: Option<serde_json::Value>,
|
pub arguments: Option<serde_json::Value>,
|
||||||
@@ -100,7 +102,7 @@ pub struct CallToolRequestParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a tool call.
|
/// The server's response to a tool call.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CallToolResult {
|
pub struct CallToolResult {
|
||||||
pub content: Vec<ContentBlock>,
|
pub content: Vec<ContentBlock>,
|
||||||
#[serde(rename = "isError", default, skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "isError", default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -121,7 +123,7 @@ impl From<CallToolResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum CancelledNotification {}
|
pub enum CancelledNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for CancelledNotification {
|
impl ModelContextProtocolNotification for CancelledNotification {
|
||||||
@@ -129,7 +131,7 @@ impl ModelContextProtocolNotification for CancelledNotification {
|
|||||||
type Params = CancelledNotificationParams;
|
type Params = CancelledNotificationParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CancelledNotificationParams {
|
pub struct CancelledNotificationParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
@@ -138,7 +140,7 @@ pub struct CancelledNotificationParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
/// Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ClientCapabilities {
|
pub struct ClientCapabilities {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub elicitation: Option<serde_json::Value>,
|
pub elicitation: Option<serde_json::Value>,
|
||||||
@@ -151,7 +153,7 @@ pub struct ClientCapabilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Present if the client supports listing roots.
|
/// Present if the client supports listing roots.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ClientCapabilitiesRoots {
|
pub struct ClientCapabilitiesRoots {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "listChanged",
|
rename = "listChanged",
|
||||||
@@ -161,7 +163,7 @@ pub struct ClientCapabilitiesRoots {
|
|||||||
pub list_changed: Option<bool>,
|
pub list_changed: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ClientNotification {
|
pub enum ClientNotification {
|
||||||
CancelledNotification(CancelledNotification),
|
CancelledNotification(CancelledNotification),
|
||||||
@@ -170,7 +172,7 @@ pub enum ClientNotification {
|
|||||||
RootsListChangedNotification(RootsListChangedNotification),
|
RootsListChangedNotification(RootsListChangedNotification),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(tag = "method", content = "params")]
|
#[serde(tag = "method", content = "params")]
|
||||||
pub enum ClientRequest {
|
pub enum ClientRequest {
|
||||||
#[serde(rename = "initialize")]
|
#[serde(rename = "initialize")]
|
||||||
@@ -203,7 +205,7 @@ pub enum ClientRequest {
|
|||||||
CompleteRequest(<CompleteRequest as ModelContextProtocolRequest>::Params),
|
CompleteRequest(<CompleteRequest as ModelContextProtocolRequest>::Params),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ClientResult {
|
pub enum ClientResult {
|
||||||
Result(Result),
|
Result(Result),
|
||||||
@@ -212,7 +214,7 @@ pub enum ClientResult {
|
|||||||
ElicitResult(ElicitResult),
|
ElicitResult(ElicitResult),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum CompleteRequest {}
|
pub enum CompleteRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for CompleteRequest {
|
impl ModelContextProtocolRequest for CompleteRequest {
|
||||||
@@ -221,7 +223,7 @@ impl ModelContextProtocolRequest for CompleteRequest {
|
|||||||
type Result = CompleteResult;
|
type Result = CompleteResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CompleteRequestParams {
|
pub struct CompleteRequestParams {
|
||||||
pub argument: CompleteRequestParamsArgument,
|
pub argument: CompleteRequestParamsArgument,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -230,20 +232,20 @@ pub struct CompleteRequestParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Additional, optional context for completions
|
/// Additional, optional context for completions
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CompleteRequestParamsContext {
|
pub struct CompleteRequestParamsContext {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub arguments: Option<serde_json::Value>,
|
pub arguments: Option<serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The argument's information
|
/// The argument's information
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CompleteRequestParamsArgument {
|
pub struct CompleteRequestParamsArgument {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub value: String,
|
pub value: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum CompleteRequestParamsRef {
|
pub enum CompleteRequestParamsRef {
|
||||||
PromptReference(PromptReference),
|
PromptReference(PromptReference),
|
||||||
@@ -251,12 +253,12 @@ pub enum CompleteRequestParamsRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a completion/complete request
|
/// The server's response to a completion/complete request
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CompleteResult {
|
pub struct CompleteResult {
|
||||||
pub completion: CompleteResultCompletion,
|
pub completion: CompleteResultCompletion,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CompleteResultCompletion {
|
pub struct CompleteResultCompletion {
|
||||||
#[serde(rename = "hasMore", default, skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "hasMore", default, skip_serializing_if = "Option::is_none")]
|
||||||
pub has_more: Option<bool>,
|
pub has_more: Option<bool>,
|
||||||
@@ -273,7 +275,7 @@ impl From<CompleteResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ContentBlock {
|
pub enum ContentBlock {
|
||||||
TextContent(TextContent),
|
TextContent(TextContent),
|
||||||
@@ -283,7 +285,7 @@ pub enum ContentBlock {
|
|||||||
EmbeddedResource(EmbeddedResource),
|
EmbeddedResource(EmbeddedResource),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum CreateMessageRequest {}
|
pub enum CreateMessageRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for CreateMessageRequest {
|
impl ModelContextProtocolRequest for CreateMessageRequest {
|
||||||
@@ -292,7 +294,7 @@ impl ModelContextProtocolRequest for CreateMessageRequest {
|
|||||||
type Result = CreateMessageResult;
|
type Result = CreateMessageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CreateMessageRequestParams {
|
pub struct CreateMessageRequestParams {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "includeContext",
|
rename = "includeContext",
|
||||||
@@ -328,7 +330,7 @@ pub struct CreateMessageRequestParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
|
/// The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct CreateMessageResult {
|
pub struct CreateMessageResult {
|
||||||
pub content: CreateMessageResultContent,
|
pub content: CreateMessageResultContent,
|
||||||
pub model: String,
|
pub model: String,
|
||||||
@@ -341,7 +343,7 @@ pub struct CreateMessageResult {
|
|||||||
pub stop_reason: Option<String>,
|
pub stop_reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum CreateMessageResultContent {
|
pub enum CreateMessageResultContent {
|
||||||
TextContent(TextContent),
|
TextContent(TextContent),
|
||||||
@@ -357,10 +359,10 @@ impl From<CreateMessageResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Cursor(String);
|
pub struct Cursor(String);
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ElicitRequest {}
|
pub enum ElicitRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ElicitRequest {
|
impl ModelContextProtocolRequest for ElicitRequest {
|
||||||
@@ -369,7 +371,7 @@ impl ModelContextProtocolRequest for ElicitRequest {
|
|||||||
type Result = ElicitResult;
|
type Result = ElicitResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ElicitRequestParams {
|
pub struct ElicitRequestParams {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
#[serde(rename = "requestedSchema")]
|
#[serde(rename = "requestedSchema")]
|
||||||
@@ -378,7 +380,7 @@ pub struct ElicitRequestParams {
|
|||||||
|
|
||||||
/// A restricted subset of JSON Schema.
|
/// A restricted subset of JSON Schema.
|
||||||
/// Only top-level properties are allowed, without nesting.
|
/// Only top-level properties are allowed, without nesting.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ElicitRequestParamsRequestedSchema {
|
pub struct ElicitRequestParamsRequestedSchema {
|
||||||
pub properties: serde_json::Value,
|
pub properties: serde_json::Value,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -387,7 +389,7 @@ pub struct ElicitRequestParamsRequestedSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The client's response to an elicitation request.
|
/// The client's response to an elicitation request.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ElicitResult {
|
pub struct ElicitResult {
|
||||||
pub action: String,
|
pub action: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -406,7 +408,7 @@ impl From<ElicitResult> for serde_json::Value {
|
|||||||
///
|
///
|
||||||
/// It is up to the client how best to render embedded resources for the benefit
|
/// It is up to the client how best to render embedded resources for the benefit
|
||||||
/// of the LLM and/or the user.
|
/// of the LLM and/or the user.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct EmbeddedResource {
|
pub struct EmbeddedResource {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -414,7 +416,7 @@ pub struct EmbeddedResource {
|
|||||||
pub r#type: String, // &'static str = "resource"
|
pub r#type: String, // &'static str = "resource"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum EmbeddedResourceResource {
|
pub enum EmbeddedResourceResource {
|
||||||
TextResourceContents(TextResourceContents),
|
TextResourceContents(TextResourceContents),
|
||||||
@@ -423,7 +425,7 @@ pub enum EmbeddedResourceResource {
|
|||||||
|
|
||||||
pub type EmptyResult = Result;
|
pub type EmptyResult = Result;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct EnumSchema {
|
pub struct EnumSchema {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
@@ -435,7 +437,7 @@ pub struct EnumSchema {
|
|||||||
pub r#type: String, // &'static str = "string"
|
pub r#type: String, // &'static str = "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum GetPromptRequest {}
|
pub enum GetPromptRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for GetPromptRequest {
|
impl ModelContextProtocolRequest for GetPromptRequest {
|
||||||
@@ -444,7 +446,7 @@ impl ModelContextProtocolRequest for GetPromptRequest {
|
|||||||
type Result = GetPromptResult;
|
type Result = GetPromptResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct GetPromptRequestParams {
|
pub struct GetPromptRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub arguments: Option<serde_json::Value>,
|
pub arguments: Option<serde_json::Value>,
|
||||||
@@ -452,7 +454,7 @@ pub struct GetPromptRequestParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a prompts/get request from the client.
|
/// The server's response to a prompts/get request from the client.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct GetPromptResult {
|
pub struct GetPromptResult {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
@@ -468,7 +470,7 @@ impl From<GetPromptResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An image provided to or from an LLM.
|
/// An image provided to or from an LLM.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ImageContent {
|
pub struct ImageContent {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -479,7 +481,7 @@ pub struct ImageContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Describes the name and version of an MCP implementation, with an optional title for UI representation.
|
/// Describes the name and version of an MCP implementation, with an optional title for UI representation.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Implementation {
|
pub struct Implementation {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -487,7 +489,7 @@ pub struct Implementation {
|
|||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum InitializeRequest {}
|
pub enum InitializeRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for InitializeRequest {
|
impl ModelContextProtocolRequest for InitializeRequest {
|
||||||
@@ -496,7 +498,7 @@ impl ModelContextProtocolRequest for InitializeRequest {
|
|||||||
type Result = InitializeResult;
|
type Result = InitializeResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct InitializeRequestParams {
|
pub struct InitializeRequestParams {
|
||||||
pub capabilities: ClientCapabilities,
|
pub capabilities: ClientCapabilities,
|
||||||
#[serde(rename = "clientInfo")]
|
#[serde(rename = "clientInfo")]
|
||||||
@@ -506,7 +508,7 @@ pub struct InitializeRequestParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// After receiving an initialize request from the client, the server sends this response.
|
/// After receiving an initialize request from the client, the server sends this response.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct InitializeResult {
|
pub struct InitializeResult {
|
||||||
pub capabilities: ServerCapabilities,
|
pub capabilities: ServerCapabilities,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -525,7 +527,7 @@ impl From<InitializeResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum InitializedNotification {}
|
pub enum InitializedNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for InitializedNotification {
|
impl ModelContextProtocolNotification for InitializedNotification {
|
||||||
@@ -534,7 +536,7 @@ impl ModelContextProtocolNotification for InitializedNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A response to a request that indicates an error occurred.
|
/// A response to a request that indicates an error occurred.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct JSONRPCError {
|
pub struct JSONRPCError {
|
||||||
pub error: JSONRPCErrorError,
|
pub error: JSONRPCErrorError,
|
||||||
pub id: RequestId,
|
pub id: RequestId,
|
||||||
@@ -542,7 +544,7 @@ pub struct JSONRPCError {
|
|||||||
pub jsonrpc: String,
|
pub jsonrpc: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct JSONRPCErrorError {
|
pub struct JSONRPCErrorError {
|
||||||
pub code: i64,
|
pub code: i64,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -551,7 +553,7 @@ pub struct JSONRPCErrorError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
|
/// Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum JSONRPCMessage {
|
pub enum JSONRPCMessage {
|
||||||
Request(JSONRPCRequest),
|
Request(JSONRPCRequest),
|
||||||
@@ -561,7 +563,7 @@ pub enum JSONRPCMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A notification which does not expect a response.
|
/// A notification which does not expect a response.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct JSONRPCNotification {
|
pub struct JSONRPCNotification {
|
||||||
#[serde(rename = "jsonrpc", default = "default_jsonrpc")]
|
#[serde(rename = "jsonrpc", default = "default_jsonrpc")]
|
||||||
pub jsonrpc: String,
|
pub jsonrpc: String,
|
||||||
@@ -571,7 +573,7 @@ pub struct JSONRPCNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A request that expects a response.
|
/// A request that expects a response.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct JSONRPCRequest {
|
pub struct JSONRPCRequest {
|
||||||
pub id: RequestId,
|
pub id: RequestId,
|
||||||
#[serde(rename = "jsonrpc", default = "default_jsonrpc")]
|
#[serde(rename = "jsonrpc", default = "default_jsonrpc")]
|
||||||
@@ -582,7 +584,7 @@ pub struct JSONRPCRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A successful (non-error) response to a request.
|
/// A successful (non-error) response to a request.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct JSONRPCResponse {
|
pub struct JSONRPCResponse {
|
||||||
pub id: RequestId,
|
pub id: RequestId,
|
||||||
#[serde(rename = "jsonrpc", default = "default_jsonrpc")]
|
#[serde(rename = "jsonrpc", default = "default_jsonrpc")]
|
||||||
@@ -590,7 +592,7 @@ pub struct JSONRPCResponse {
|
|||||||
pub result: Result,
|
pub result: Result,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ListPromptsRequest {}
|
pub enum ListPromptsRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ListPromptsRequest {
|
impl ModelContextProtocolRequest for ListPromptsRequest {
|
||||||
@@ -599,14 +601,14 @@ impl ModelContextProtocolRequest for ListPromptsRequest {
|
|||||||
type Result = ListPromptsResult;
|
type Result = ListPromptsResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListPromptsRequestParams {
|
pub struct ListPromptsRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub cursor: Option<String>,
|
pub cursor: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a prompts/list request from the client.
|
/// The server's response to a prompts/list request from the client.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListPromptsResult {
|
pub struct ListPromptsResult {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "nextCursor",
|
rename = "nextCursor",
|
||||||
@@ -625,7 +627,7 @@ impl From<ListPromptsResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ListResourceTemplatesRequest {}
|
pub enum ListResourceTemplatesRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ListResourceTemplatesRequest {
|
impl ModelContextProtocolRequest for ListResourceTemplatesRequest {
|
||||||
@@ -634,14 +636,14 @@ impl ModelContextProtocolRequest for ListResourceTemplatesRequest {
|
|||||||
type Result = ListResourceTemplatesResult;
|
type Result = ListResourceTemplatesResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListResourceTemplatesRequestParams {
|
pub struct ListResourceTemplatesRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub cursor: Option<String>,
|
pub cursor: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a resources/templates/list request from the client.
|
/// The server's response to a resources/templates/list request from the client.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListResourceTemplatesResult {
|
pub struct ListResourceTemplatesResult {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "nextCursor",
|
rename = "nextCursor",
|
||||||
@@ -661,7 +663,7 @@ impl From<ListResourceTemplatesResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ListResourcesRequest {}
|
pub enum ListResourcesRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ListResourcesRequest {
|
impl ModelContextProtocolRequest for ListResourcesRequest {
|
||||||
@@ -670,14 +672,14 @@ impl ModelContextProtocolRequest for ListResourcesRequest {
|
|||||||
type Result = ListResourcesResult;
|
type Result = ListResourcesResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListResourcesRequestParams {
|
pub struct ListResourcesRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub cursor: Option<String>,
|
pub cursor: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a resources/list request from the client.
|
/// The server's response to a resources/list request from the client.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListResourcesResult {
|
pub struct ListResourcesResult {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "nextCursor",
|
rename = "nextCursor",
|
||||||
@@ -696,7 +698,7 @@ impl From<ListResourcesResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ListRootsRequest {}
|
pub enum ListRootsRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ListRootsRequest {
|
impl ModelContextProtocolRequest for ListRootsRequest {
|
||||||
@@ -708,7 +710,7 @@ impl ModelContextProtocolRequest for ListRootsRequest {
|
|||||||
/// The client's response to a roots/list request from the server.
|
/// The client's response to a roots/list request from the server.
|
||||||
/// This result contains an array of Root objects, each representing a root directory
|
/// This result contains an array of Root objects, each representing a root directory
|
||||||
/// or file that the server can operate on.
|
/// or file that the server can operate on.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListRootsResult {
|
pub struct ListRootsResult {
|
||||||
pub roots: Vec<Root>,
|
pub roots: Vec<Root>,
|
||||||
}
|
}
|
||||||
@@ -721,7 +723,7 @@ impl From<ListRootsResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ListToolsRequest {}
|
pub enum ListToolsRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ListToolsRequest {
|
impl ModelContextProtocolRequest for ListToolsRequest {
|
||||||
@@ -730,14 +732,14 @@ impl ModelContextProtocolRequest for ListToolsRequest {
|
|||||||
type Result = ListToolsResult;
|
type Result = ListToolsResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListToolsRequestParams {
|
pub struct ListToolsRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub cursor: Option<String>,
|
pub cursor: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a tools/list request from the client.
|
/// The server's response to a tools/list request from the client.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ListToolsResult {
|
pub struct ListToolsResult {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "nextCursor",
|
rename = "nextCursor",
|
||||||
@@ -760,7 +762,7 @@ impl From<ListToolsResult> for serde_json::Value {
|
|||||||
///
|
///
|
||||||
/// These map to syslog message severities, as specified in RFC-5424:
|
/// These map to syslog message severities, as specified in RFC-5424:
|
||||||
/// https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
|
/// https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum LoggingLevel {
|
pub enum LoggingLevel {
|
||||||
#[serde(rename = "alert")]
|
#[serde(rename = "alert")]
|
||||||
Alert,
|
Alert,
|
||||||
@@ -780,7 +782,7 @@ pub enum LoggingLevel {
|
|||||||
Warning,
|
Warning,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum LoggingMessageNotification {}
|
pub enum LoggingMessageNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for LoggingMessageNotification {
|
impl ModelContextProtocolNotification for LoggingMessageNotification {
|
||||||
@@ -788,7 +790,7 @@ impl ModelContextProtocolNotification for LoggingMessageNotification {
|
|||||||
type Params = LoggingMessageNotificationParams;
|
type Params = LoggingMessageNotificationParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct LoggingMessageNotificationParams {
|
pub struct LoggingMessageNotificationParams {
|
||||||
pub data: serde_json::Value,
|
pub data: serde_json::Value,
|
||||||
pub level: LoggingLevel,
|
pub level: LoggingLevel,
|
||||||
@@ -800,7 +802,7 @@ pub struct LoggingMessageNotificationParams {
|
|||||||
///
|
///
|
||||||
/// Keys not declared here are currently left unspecified by the spec and are up
|
/// Keys not declared here are currently left unspecified by the spec and are up
|
||||||
/// to the client to interpret.
|
/// to the client to interpret.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ModelHint {
|
pub struct ModelHint {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
@@ -817,7 +819,7 @@ pub struct ModelHint {
|
|||||||
/// These preferences are always advisory. The client MAY ignore them. It is also
|
/// These preferences are always advisory. The client MAY ignore them. It is also
|
||||||
/// up to the client to decide how to interpret these preferences and how to
|
/// up to the client to decide how to interpret these preferences and how to
|
||||||
/// balance them against other considerations.
|
/// balance them against other considerations.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ModelPreferences {
|
pub struct ModelPreferences {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "costPriority",
|
rename = "costPriority",
|
||||||
@@ -841,14 +843,14 @@ pub struct ModelPreferences {
|
|||||||
pub speed_priority: Option<f64>,
|
pub speed_priority: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Notification {
|
pub struct Notification {
|
||||||
pub method: String,
|
pub method: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub params: Option<serde_json::Value>,
|
pub params: Option<serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct NumberSchema {
|
pub struct NumberSchema {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
@@ -861,20 +863,20 @@ pub struct NumberSchema {
|
|||||||
pub r#type: String,
|
pub r#type: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct PaginatedRequest {
|
pub struct PaginatedRequest {
|
||||||
pub method: String,
|
pub method: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub params: Option<PaginatedRequestParams>,
|
pub params: Option<PaginatedRequestParams>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct PaginatedRequestParams {
|
pub struct PaginatedRequestParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub cursor: Option<String>,
|
pub cursor: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct PaginatedResult {
|
pub struct PaginatedResult {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "nextCursor",
|
rename = "nextCursor",
|
||||||
@@ -892,7 +894,7 @@ impl From<PaginatedResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum PingRequest {}
|
pub enum PingRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for PingRequest {
|
impl ModelContextProtocolRequest for PingRequest {
|
||||||
@@ -903,7 +905,7 @@ impl ModelContextProtocolRequest for PingRequest {
|
|||||||
|
|
||||||
/// Restricted schema definitions that only allow primitive types
|
/// Restricted schema definitions that only allow primitive types
|
||||||
/// without nested objects or arrays.
|
/// without nested objects or arrays.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum PrimitiveSchemaDefinition {
|
pub enum PrimitiveSchemaDefinition {
|
||||||
StringSchema(StringSchema),
|
StringSchema(StringSchema),
|
||||||
@@ -912,7 +914,7 @@ pub enum PrimitiveSchemaDefinition {
|
|||||||
EnumSchema(EnumSchema),
|
EnumSchema(EnumSchema),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ProgressNotification {}
|
pub enum ProgressNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for ProgressNotification {
|
impl ModelContextProtocolNotification for ProgressNotification {
|
||||||
@@ -920,7 +922,7 @@ impl ModelContextProtocolNotification for ProgressNotification {
|
|||||||
type Params = ProgressNotificationParams;
|
type Params = ProgressNotificationParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ProgressNotificationParams {
|
pub struct ProgressNotificationParams {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub message: Option<String>,
|
pub message: Option<String>,
|
||||||
@@ -931,7 +933,7 @@ pub struct ProgressNotificationParams {
|
|||||||
pub total: Option<f64>,
|
pub total: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ProgressToken {
|
pub enum ProgressToken {
|
||||||
String(String),
|
String(String),
|
||||||
@@ -939,7 +941,7 @@ pub enum ProgressToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A prompt or prompt template that the server offers.
|
/// A prompt or prompt template that the server offers.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Prompt {
|
pub struct Prompt {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub arguments: Option<Vec<PromptArgument>>,
|
pub arguments: Option<Vec<PromptArgument>>,
|
||||||
@@ -951,7 +953,7 @@ pub struct Prompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Describes an argument that a prompt can accept.
|
/// Describes an argument that a prompt can accept.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct PromptArgument {
|
pub struct PromptArgument {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
@@ -962,7 +964,7 @@ pub struct PromptArgument {
|
|||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum PromptListChangedNotification {}
|
pub enum PromptListChangedNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for PromptListChangedNotification {
|
impl ModelContextProtocolNotification for PromptListChangedNotification {
|
||||||
@@ -974,14 +976,14 @@ impl ModelContextProtocolNotification for PromptListChangedNotification {
|
|||||||
///
|
///
|
||||||
/// This is similar to `SamplingMessage`, but also supports the embedding of
|
/// This is similar to `SamplingMessage`, but also supports the embedding of
|
||||||
/// resources from the MCP server.
|
/// resources from the MCP server.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct PromptMessage {
|
pub struct PromptMessage {
|
||||||
pub content: ContentBlock,
|
pub content: ContentBlock,
|
||||||
pub role: Role,
|
pub role: Role,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identifies a prompt.
|
/// Identifies a prompt.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct PromptReference {
|
pub struct PromptReference {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -989,7 +991,7 @@ pub struct PromptReference {
|
|||||||
pub r#type: String, // &'static str = "ref/prompt"
|
pub r#type: String, // &'static str = "ref/prompt"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ReadResourceRequest {}
|
pub enum ReadResourceRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for ReadResourceRequest {
|
impl ModelContextProtocolRequest for ReadResourceRequest {
|
||||||
@@ -998,18 +1000,18 @@ impl ModelContextProtocolRequest for ReadResourceRequest {
|
|||||||
type Result = ReadResourceResult;
|
type Result = ReadResourceResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ReadResourceRequestParams {
|
pub struct ReadResourceRequestParams {
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server's response to a resources/read request from the client.
|
/// The server's response to a resources/read request from the client.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ReadResourceResult {
|
pub struct ReadResourceResult {
|
||||||
pub contents: Vec<ReadResourceResultContents>,
|
pub contents: Vec<ReadResourceResultContents>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ReadResourceResultContents {
|
pub enum ReadResourceResultContents {
|
||||||
TextResourceContents(TextResourceContents),
|
TextResourceContents(TextResourceContents),
|
||||||
@@ -1024,14 +1026,14 @@ impl From<ReadResourceResult> for serde_json::Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
pub method: String,
|
pub method: String,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub params: Option<serde_json::Value>,
|
pub params: Option<serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum RequestId {
|
pub enum RequestId {
|
||||||
String(String),
|
String(String),
|
||||||
@@ -1039,7 +1041,7 @@ pub enum RequestId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A known resource that the server is capable of reading.
|
/// A known resource that the server is capable of reading.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Resource {
|
pub struct Resource {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -1056,7 +1058,7 @@ pub struct Resource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The contents of a specific resource or sub-resource.
|
/// The contents of a specific resource or sub-resource.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ResourceContents {
|
pub struct ResourceContents {
|
||||||
#[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
|
||||||
pub mime_type: Option<String>,
|
pub mime_type: Option<String>,
|
||||||
@@ -1066,7 +1068,7 @@ pub struct ResourceContents {
|
|||||||
/// A resource that the server is capable of reading, included in a prompt or tool call result.
|
/// A resource that the server is capable of reading, included in a prompt or tool call result.
|
||||||
///
|
///
|
||||||
/// Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
|
/// Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ResourceLink {
|
pub struct ResourceLink {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -1083,7 +1085,7 @@ pub struct ResourceLink {
|
|||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ResourceListChangedNotification {}
|
pub enum ResourceListChangedNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for ResourceListChangedNotification {
|
impl ModelContextProtocolNotification for ResourceListChangedNotification {
|
||||||
@@ -1092,7 +1094,7 @@ impl ModelContextProtocolNotification for ResourceListChangedNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A template description for resources available on the server.
|
/// A template description for resources available on the server.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ResourceTemplate {
|
pub struct ResourceTemplate {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -1108,13 +1110,13 @@ pub struct ResourceTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A reference to a resource or resource template definition.
|
/// A reference to a resource or resource template definition.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ResourceTemplateReference {
|
pub struct ResourceTemplateReference {
|
||||||
pub r#type: String, // &'static str = "ref/resource"
|
pub r#type: String, // &'static str = "ref/resource"
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ResourceUpdatedNotification {}
|
pub enum ResourceUpdatedNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for ResourceUpdatedNotification {
|
impl ModelContextProtocolNotification for ResourceUpdatedNotification {
|
||||||
@@ -1122,7 +1124,7 @@ impl ModelContextProtocolNotification for ResourceUpdatedNotification {
|
|||||||
type Params = ResourceUpdatedNotificationParams;
|
type Params = ResourceUpdatedNotificationParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ResourceUpdatedNotificationParams {
|
pub struct ResourceUpdatedNotificationParams {
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
@@ -1130,7 +1132,7 @@ pub struct ResourceUpdatedNotificationParams {
|
|||||||
pub type Result = serde_json::Value;
|
pub type Result = serde_json::Value;
|
||||||
|
|
||||||
/// The sender or recipient of messages and data in a conversation.
|
/// The sender or recipient of messages and data in a conversation.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum Role {
|
pub enum Role {
|
||||||
#[serde(rename = "assistant")]
|
#[serde(rename = "assistant")]
|
||||||
Assistant,
|
Assistant,
|
||||||
@@ -1139,14 +1141,14 @@ pub enum Role {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a root directory or file that the server can operate on.
|
/// Represents a root directory or file that the server can operate on.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Root {
|
pub struct Root {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum RootsListChangedNotification {}
|
pub enum RootsListChangedNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for RootsListChangedNotification {
|
impl ModelContextProtocolNotification for RootsListChangedNotification {
|
||||||
@@ -1155,13 +1157,13 @@ impl ModelContextProtocolNotification for RootsListChangedNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Describes a message issued to or received from an LLM API.
|
/// Describes a message issued to or received from an LLM API.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct SamplingMessage {
|
pub struct SamplingMessage {
|
||||||
pub content: SamplingMessageContent,
|
pub content: SamplingMessageContent,
|
||||||
pub role: Role,
|
pub role: Role,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum SamplingMessageContent {
|
pub enum SamplingMessageContent {
|
||||||
TextContent(TextContent),
|
TextContent(TextContent),
|
||||||
@@ -1170,7 +1172,7 @@ pub enum SamplingMessageContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
|
/// Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ServerCapabilities {
|
pub struct ServerCapabilities {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub completions: Option<serde_json::Value>,
|
pub completions: Option<serde_json::Value>,
|
||||||
@@ -1187,7 +1189,7 @@ pub struct ServerCapabilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Present if the server offers any tools to call.
|
/// Present if the server offers any tools to call.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ServerCapabilitiesTools {
|
pub struct ServerCapabilitiesTools {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "listChanged",
|
rename = "listChanged",
|
||||||
@@ -1198,7 +1200,7 @@ pub struct ServerCapabilitiesTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Present if the server offers any resources to read.
|
/// Present if the server offers any resources to read.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ServerCapabilitiesResources {
|
pub struct ServerCapabilitiesResources {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "listChanged",
|
rename = "listChanged",
|
||||||
@@ -1211,7 +1213,7 @@ pub struct ServerCapabilitiesResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Present if the server offers any prompt templates.
|
/// Present if the server offers any prompt templates.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ServerCapabilitiesPrompts {
|
pub struct ServerCapabilitiesPrompts {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "listChanged",
|
rename = "listChanged",
|
||||||
@@ -1221,7 +1223,7 @@ pub struct ServerCapabilitiesPrompts {
|
|||||||
pub list_changed: Option<bool>,
|
pub list_changed: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(tag = "method", content = "params")]
|
#[serde(tag = "method", content = "params")]
|
||||||
pub enum ServerNotification {
|
pub enum ServerNotification {
|
||||||
#[serde(rename = "notifications/cancelled")]
|
#[serde(rename = "notifications/cancelled")]
|
||||||
@@ -1250,7 +1252,7 @@ pub enum ServerNotification {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ServerRequest {
|
pub enum ServerRequest {
|
||||||
PingRequest(PingRequest),
|
PingRequest(PingRequest),
|
||||||
@@ -1259,7 +1261,7 @@ pub enum ServerRequest {
|
|||||||
ElicitRequest(ElicitRequest),
|
ElicitRequest(ElicitRequest),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum ServerResult {
|
pub enum ServerResult {
|
||||||
@@ -1275,7 +1277,7 @@ pub enum ServerResult {
|
|||||||
CompleteResult(CompleteResult),
|
CompleteResult(CompleteResult),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum SetLevelRequest {}
|
pub enum SetLevelRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for SetLevelRequest {
|
impl ModelContextProtocolRequest for SetLevelRequest {
|
||||||
@@ -1284,12 +1286,12 @@ impl ModelContextProtocolRequest for SetLevelRequest {
|
|||||||
type Result = Result;
|
type Result = Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct SetLevelRequestParams {
|
pub struct SetLevelRequestParams {
|
||||||
pub level: LoggingLevel,
|
pub level: LoggingLevel,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct StringSchema {
|
pub struct StringSchema {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
@@ -1304,7 +1306,7 @@ pub struct StringSchema {
|
|||||||
pub r#type: String, // &'static str = "string"
|
pub r#type: String, // &'static str = "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum SubscribeRequest {}
|
pub enum SubscribeRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for SubscribeRequest {
|
impl ModelContextProtocolRequest for SubscribeRequest {
|
||||||
@@ -1313,13 +1315,13 @@ impl ModelContextProtocolRequest for SubscribeRequest {
|
|||||||
type Result = Result;
|
type Result = Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct SubscribeRequestParams {
|
pub struct SubscribeRequestParams {
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Text provided to or from an LLM.
|
/// Text provided to or from an LLM.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct TextContent {
|
pub struct TextContent {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<Annotations>,
|
pub annotations: Option<Annotations>,
|
||||||
@@ -1327,7 +1329,7 @@ pub struct TextContent {
|
|||||||
pub r#type: String, // &'static str = "text"
|
pub r#type: String, // &'static str = "text"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct TextResourceContents {
|
pub struct TextResourceContents {
|
||||||
#[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
|
||||||
pub mime_type: Option<String>,
|
pub mime_type: Option<String>,
|
||||||
@@ -1336,7 +1338,7 @@ pub struct TextResourceContents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Definition for a tool the client can call.
|
/// Definition for a tool the client can call.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct Tool {
|
pub struct Tool {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub annotations: Option<ToolAnnotations>,
|
pub annotations: Option<ToolAnnotations>,
|
||||||
@@ -1357,7 +1359,7 @@ pub struct Tool {
|
|||||||
|
|
||||||
/// An optional JSON Schema object defining the structure of the tool's output returned in
|
/// An optional JSON Schema object defining the structure of the tool's output returned in
|
||||||
/// the structuredContent field of a CallToolResult.
|
/// the structuredContent field of a CallToolResult.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ToolOutputSchema {
|
pub struct ToolOutputSchema {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub properties: Option<serde_json::Value>,
|
pub properties: Option<serde_json::Value>,
|
||||||
@@ -1367,7 +1369,7 @@ pub struct ToolOutputSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A JSON Schema object defining the expected parameters for the tool.
|
/// A JSON Schema object defining the expected parameters for the tool.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ToolInputSchema {
|
pub struct ToolInputSchema {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub properties: Option<serde_json::Value>,
|
pub properties: Option<serde_json::Value>,
|
||||||
@@ -1384,7 +1386,7 @@ pub struct ToolInputSchema {
|
|||||||
///
|
///
|
||||||
/// Clients should never make tool use decisions based on ToolAnnotations
|
/// Clients should never make tool use decisions based on ToolAnnotations
|
||||||
/// received from untrusted servers.
|
/// received from untrusted servers.
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct ToolAnnotations {
|
pub struct ToolAnnotations {
|
||||||
#[serde(
|
#[serde(
|
||||||
rename = "destructiveHint",
|
rename = "destructiveHint",
|
||||||
@@ -1414,7 +1416,7 @@ pub struct ToolAnnotations {
|
|||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum ToolListChangedNotification {}
|
pub enum ToolListChangedNotification {}
|
||||||
|
|
||||||
impl ModelContextProtocolNotification for ToolListChangedNotification {
|
impl ModelContextProtocolNotification for ToolListChangedNotification {
|
||||||
@@ -1422,7 +1424,7 @@ impl ModelContextProtocolNotification for ToolListChangedNotification {
|
|||||||
type Params = Option<serde_json::Value>;
|
type Params = Option<serde_json::Value>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub enum UnsubscribeRequest {}
|
pub enum UnsubscribeRequest {}
|
||||||
|
|
||||||
impl ModelContextProtocolRequest for UnsubscribeRequest {
|
impl ModelContextProtocolRequest for UnsubscribeRequest {
|
||||||
@@ -1431,7 +1433,7 @@ impl ModelContextProtocolRequest for UnsubscribeRequest {
|
|||||||
type Result = Result;
|
type Result = Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
|
||||||
pub struct UnsubscribeRequestParams {
|
pub struct UnsubscribeRequestParams {
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user