#![allow(rustdoc::bare_urls)]
use crate::utils::Integer;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct UnsubscribeRequestParams {
#[serde(rename = "uri")]
pub r#uri: String,
}
impl UnsubscribeRequestParams {
pub fn new(r#uri: String) -> Self {
Self { r#uri }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct UnsubscribeRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: UnsubscribeRequestParams,
}
impl UnsubscribeRequest {
pub const METHOD: &str = "resources/unsubscribe";
pub fn new(r#params: UnsubscribeRequestParams) -> Self {
Self {
r#method: "resources/unsubscribe".to_string(),
r#params,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct LoggingMessageNotificationParams {
#[serde(rename = "level")]
pub r#level: LoggingLevel,
#[serde(rename = "logger")]
pub r#logger: Option<String>,
#[serde(rename = "data")]
pub r#data: serde_json::Value,
}
impl LoggingMessageNotificationParams {
pub fn new(r#level: LoggingLevel, r#data: serde_json::Value) -> Self {
Self {
r#level,
r#logger: None,
r#data,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct LoggingMessageNotification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: LoggingMessageNotificationParams,
}
impl LoggingMessageNotification {
pub const METHOD: &str = "notifications/message";
pub fn new(r#params: LoggingMessageNotificationParams) -> Self {
Self {
r#method: "notifications/message".to_string(),
r#params,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum CreateMessageResultContent {
TextContent(TextContent),
ImageContent(ImageContent),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CreateMessageResult {
#[serde(rename = "stopReason")]
pub r#stop_reason: Option<String>,
#[serde(rename = "content")]
pub r#content: CreateMessageResultContent,
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "role")]
pub r#role: Role,
#[serde(rename = "model")]
pub r#model: String,
}
impl CreateMessageResult {
pub fn new(r#content: CreateMessageResultContent, r#role: Role, r#model: String) -> Self {
Self {
r#stop_reason: None,
r#content,
r#meta: None,
r#role,
r#model,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CompleteRequestParamsArgument {
#[serde(rename = "name")]
pub r#name: String,
#[serde(rename = "value")]
pub r#value: String,
}
impl CompleteRequestParamsArgument {
pub fn new(r#name: String, r#value: String) -> Self {
Self { r#name, r#value }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum CompleteRequestParamsRef {
PromptReference(PromptReference),
ResourceReference(ResourceReference),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CompleteRequestParams {
#[serde(rename = "argument")]
pub r#argument: CompleteRequestParamsArgument,
#[serde(rename = "ref")]
pub r#ref: CompleteRequestParamsRef,
}
impl CompleteRequestParams {
pub fn new(r#argument: CompleteRequestParamsArgument, r#ref: CompleteRequestParamsRef) -> Self {
Self { r#argument, r#ref }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CompleteRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: CompleteRequestParams,
}
impl CompleteRequest {
pub const METHOD: &str = "completion/complete";
pub fn new(r#params: CompleteRequestParams) -> Self {
Self {
r#method: "completion/complete".to_string(),
r#params,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PromptMessageContent {
TextContent(TextContent),
ImageContent(ImageContent),
EmbeddedResource(EmbeddedResource),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PromptMessage {
#[serde(rename = "content")]
pub r#content: PromptMessageContent,
#[serde(rename = "role")]
pub r#role: Role,
}
impl PromptMessage {
pub fn new(r#content: PromptMessageContent, r#role: Role) -> Self {
Self { r#content, r#role }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct InitializeRequestParams {
#[serde(rename = "capabilities")]
pub r#capabilities: ClientCapabilities,
#[serde(rename = "protocolVersion")]
pub r#protocol_version: String,
#[serde(rename = "clientInfo")]
pub r#client_info: Implementation,
}
impl InitializeRequestParams {
pub fn new(
r#capabilities: ClientCapabilities,
r#protocol_version: String,
r#client_info: Implementation,
) -> Self {
Self {
r#capabilities,
r#protocol_version,
r#client_info,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct InitializeRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: InitializeRequestParams,
}
impl InitializeRequest {
pub const METHOD: &str = "initialize";
pub fn new(r#params: InitializeRequestParams) -> Self {
Self {
r#method: "initialize".to_string(),
r#params,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListToolsRequestParams {
#[serde(rename = "cursor")]
pub r#cursor: Option<String>,
}
impl ListToolsRequestParams {
pub fn new() -> Self {
Self { r#cursor: None }
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListToolsRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<ListToolsRequestParams>,
}
impl ListToolsRequest {
pub const METHOD: &str = "tools/list";
pub fn new() -> Self {
Self {
r#method: "tools/list".to_string(),
r#params: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct RequestParamsMeta {
#[serde(rename = "progressToken")]
pub r#progress_token: Option<ProgressToken>,
}
impl RequestParamsMeta {
pub fn new() -> Self {
Self {
r#progress_token: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct RequestParams {
#[serde(rename = "_meta")]
pub r#meta: Option<RequestParamsMeta>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl RequestParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Request {
#[serde(rename = "params")]
pub r#params: Option<RequestParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl Request {
pub fn new(r#method: String) -> Self {
Self {
r#params: None,
r#method,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceContents {
#[serde(rename = "uri")]
pub r#uri: String,
#[serde(rename = "mimeType")]
pub r#mime_type: Option<String>,
}
impl ResourceContents {
pub fn new(r#uri: String) -> Self {
Self {
r#uri,
r#mime_type: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ServerCapabilitiesLogging {
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl ServerCapabilitiesLogging {
pub fn new() -> Self {
Self {
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ServerCapabilitiesResources {
#[serde(rename = "subscribe")]
pub r#subscribe: Option<bool>,
#[serde(rename = "listChanged")]
pub r#list_changed: Option<bool>,
}
impl ServerCapabilitiesResources {
pub fn new() -> Self {
Self {
r#subscribe: None,
r#list_changed: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ServerCapabilitiesTools {
#[serde(rename = "listChanged")]
pub r#list_changed: Option<bool>,
}
impl ServerCapabilitiesTools {
pub fn new() -> Self {
Self {
r#list_changed: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ServerCapabilitiesPrompts {
#[serde(rename = "listChanged")]
pub r#list_changed: Option<bool>,
}
impl ServerCapabilitiesPrompts {
pub fn new() -> Self {
Self {
r#list_changed: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ServerCapabilities {
#[serde(rename = "experimental")]
pub r#experimental: Option<serde_json::Value>,
#[serde(rename = "logging")]
pub r#logging: Option<ServerCapabilitiesLogging>,
#[serde(rename = "resources")]
pub r#resources: Option<ServerCapabilitiesResources>,
#[serde(rename = "tools")]
pub r#tools: Option<ServerCapabilitiesTools>,
#[serde(rename = "prompts")]
pub r#prompts: Option<ServerCapabilitiesPrompts>,
}
impl ServerCapabilities {
pub fn new() -> Self {
Self {
r#experimental: None,
r#logging: None,
r#resources: None,
r#tools: None,
r#prompts: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListPromptsRequestParams {
#[serde(rename = "cursor")]
pub r#cursor: Option<String>,
}
impl ListPromptsRequestParams {
pub fn new() -> Self {
Self { r#cursor: None }
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListPromptsRequest {
#[serde(rename = "params")]
pub r#params: Option<ListPromptsRequestParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl ListPromptsRequest {
pub const METHOD: &str = "prompts/list";
pub fn new() -> Self {
Self {
r#params: None,
r#method: "prompts/list".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CreateMessageRequestParamsMetadata {
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl CreateMessageRequestParamsMetadata {
pub fn new() -> Self {
Self {
additional_properties: HashMap::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CreateMessageRequestParams {
#[serde(rename = "temperature")]
pub r#temperature: Option<f64>,
#[serde(rename = "messages")]
pub r#messages: Vec<SamplingMessage>,
#[serde(rename = "systemPrompt")]
pub r#system_prompt: Option<String>,
#[serde(rename = "modelPreferences")]
pub r#model_preferences: Option<ModelPreferences>,
#[serde(rename = "includeContext")]
pub r#include_context: Option<String>,
#[serde(rename = "maxTokens")]
pub r#max_tokens: Integer,
#[serde(rename = "stopSequences")]
pub r#stop_sequences: Option<Vec<String>>,
#[serde(rename = "metadata")]
pub r#metadata: Option<CreateMessageRequestParamsMetadata>,
}
impl CreateMessageRequestParams {
pub fn new(r#messages: Vec<SamplingMessage>, r#max_tokens: Integer) -> Self {
Self {
r#temperature: None,
r#messages,
r#system_prompt: None,
r#model_preferences: None,
r#include_context: None,
r#max_tokens,
r#stop_sequences: None,
r#metadata: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CreateMessageRequest {
#[serde(rename = "params")]
pub r#params: CreateMessageRequestParams,
#[serde(rename = "method")]
pub r#method: String,
}
impl CreateMessageRequest {
pub const METHOD: &str = "sampling/createMessage";
pub fn new(r#params: CreateMessageRequestParams) -> Self {
Self {
r#params,
r#method: "sampling/createMessage".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ToolListChangedNotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl ToolListChangedNotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ToolListChangedNotification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<ToolListChangedNotificationParams>,
}
impl ToolListChangedNotification {
pub const METHOD: &str = "notifications/tools/list_changed";
pub fn new() -> Self {
Self {
r#method: "notifications/tools/list_changed".to_string(),
r#params: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Prompt {
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "arguments")]
pub r#arguments: Option<Vec<PromptArgument>>,
#[serde(rename = "name")]
pub r#name: String,
}
impl Prompt {
pub fn new(r#name: String) -> Self {
Self {
r#description: None,
r#arguments: None,
r#name,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct NotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl NotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Notification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<NotificationParams>,
}
impl Notification {
pub fn new(r#method: String) -> Self {
Self {
r#method,
r#params: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct RootsListChangedNotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl RootsListChangedNotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct RootsListChangedNotification {
#[serde(rename = "params")]
pub r#params: Option<RootsListChangedNotificationParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl RootsListChangedNotification {
pub const METHOD: &str = "notifications/roots/list_changed";
pub fn new() -> Self {
Self {
r#params: None,
r#method: "notifications/roots/list_changed".to_string(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ReadResourceRequestParams {
#[serde(rename = "uri")]
pub r#uri: String,
}
impl ReadResourceRequestParams {
pub fn new(r#uri: String) -> Self {
Self { r#uri }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ReadResourceRequest {
#[serde(rename = "params")]
pub r#params: ReadResourceRequestParams,
#[serde(rename = "method")]
pub r#method: String,
}
impl ReadResourceRequest {
pub const METHOD: &str = "resources/read";
pub fn new(r#params: ReadResourceRequestParams) -> Self {
Self {
r#params,
r#method: "resources/read".to_string(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListToolsResult {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "nextCursor")]
pub r#next_cursor: Option<String>,
#[serde(rename = "tools")]
pub r#tools: Vec<Tool>,
}
impl ListToolsResult {
pub fn new(r#tools: Vec<Tool>) -> Self {
Self {
r#meta: None,
r#next_cursor: None,
r#tools,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub enum Cursor {
String(String),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PromptListChangedNotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl PromptListChangedNotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PromptListChangedNotification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<PromptListChangedNotificationParams>,
}
impl PromptListChangedNotification {
pub const METHOD: &str = "notifications/prompts/list_changed";
pub fn new() -> Self {
Self {
r#method: "notifications/prompts/list_changed".to_string(),
r#params: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PromptReference {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub r#name: String,
}
impl PromptReference {
pub const TYPE: &str = "ref/prompt";
pub fn new(r#name: String) -> Self {
Self {
r#type: "ref/prompt".to_string(),
r#name,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct SetLevelRequestParams {
#[serde(rename = "level")]
pub r#level: LoggingLevel,
}
impl SetLevelRequestParams {
pub fn new(r#level: LoggingLevel) -> Self {
Self { r#level }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct SetLevelRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: SetLevelRequestParams,
}
impl SetLevelRequest {
pub const METHOD: &str = "logging/setLevel";
pub fn new(r#params: SetLevelRequestParams) -> Self {
Self {
r#method: "logging/setLevel".to_string(),
r#params,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ServerRequest {
PingRequest(PingRequest),
CreateMessageRequest(CreateMessageRequest),
ListRootsRequest(ListRootsRequest),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct GetPromptRequestParams {
#[serde(rename = "arguments")]
pub r#arguments: Option<serde_json::Value>,
#[serde(rename = "name")]
pub r#name: String,
}
impl GetPromptRequestParams {
pub fn new(r#name: String) -> Self {
Self {
r#arguments: None,
r#name,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct GetPromptRequest {
#[serde(rename = "params")]
pub r#params: GetPromptRequestParams,
#[serde(rename = "method")]
pub r#method: String,
}
impl GetPromptRequest {
pub const METHOD: &str = "prompts/get";
pub fn new(r#params: GetPromptRequestParams) -> Self {
Self {
r#params,
r#method: "prompts/get".to_string(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CancelledNotificationParams {
#[serde(rename = "requestId")]
pub r#request_id: RequestId,
#[serde(rename = "reason")]
pub r#reason: Option<String>,
}
impl CancelledNotificationParams {
pub fn new(r#request_id: RequestId) -> Self {
Self {
r#request_id,
r#reason: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CancelledNotification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: CancelledNotificationParams,
}
impl CancelledNotification {
pub const METHOD: &str = "notifications/cancelled";
pub fn new(r#params: CancelledNotificationParams) -> Self {
Self {
r#method: "notifications/cancelled".to_string(),
r#params,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ImageContentAnnotations {
#[serde(rename = "priority")]
pub r#priority: Option<f64>,
#[serde(rename = "audience")]
pub r#audience: Option<Vec<Role>>,
}
impl ImageContentAnnotations {
pub fn new() -> Self {
Self {
r#priority: None,
r#audience: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ImageContent {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "annotations")]
pub r#annotations: Option<ImageContentAnnotations>,
#[serde(rename = "data")]
pub r#data: String,
#[serde(rename = "mimeType")]
pub r#mime_type: String,
}
impl ImageContent {
pub const TYPE: &str = "image";
pub fn new(r#data: String, r#mime_type: String) -> Self {
Self {
r#type: "image".to_string(),
r#annotations: None,
r#data,
r#mime_type,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum JSONRPCMessage {
JSONRPCRequest(JSONRPCRequest),
JSONRPCNotification(JSONRPCNotification),
JSONRPCResponse(JSONRPCResponse),
JSONRPCError(JSONRPCError),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ServerResult {
Result(Result),
InitializeResult(InitializeResult),
ListResourcesResult(ListResourcesResult),
ListResourceTemplatesResult(ListResourceTemplatesResult),
ReadResourceResult(ReadResourceResult),
ListPromptsResult(ListPromptsResult),
GetPromptResult(GetPromptResult),
ListToolsResult(ListToolsResult),
CallToolResult(CallToolResult),
CompleteResult(CompleteResult),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListPromptsResult {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "nextCursor")]
pub r#next_cursor: Option<String>,
#[serde(rename = "prompts")]
pub r#prompts: Vec<Prompt>,
}
impl ListPromptsResult {
pub fn new(r#prompts: Vec<Prompt>) -> Self {
Self {
r#meta: None,
r#next_cursor: None,
r#prompts,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PromptArgument {
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "required")]
pub r#required: Option<bool>,
#[serde(rename = "name")]
pub r#name: String,
}
impl PromptArgument {
pub fn new(r#name: String) -> Self {
Self {
r#description: None,
r#required: None,
r#name,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CompleteResultCompletion {
#[serde(rename = "total")]
pub r#total: Option<Integer>,
#[serde(rename = "hasMore")]
pub r#has_more: Option<bool>,
#[serde(rename = "values")]
pub r#values: Vec<String>,
}
impl CompleteResultCompletion {
pub fn new(r#values: Vec<String>) -> Self {
Self {
r#total: None,
r#has_more: None,
r#values,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CompleteResult {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "completion")]
pub r#completion: CompleteResultCompletion,
}
impl CompleteResult {
pub fn new(r#completion: CompleteResultCompletion) -> Self {
Self {
r#meta: None,
r#completion,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListResourceTemplatesRequestParams {
#[serde(rename = "cursor")]
pub r#cursor: Option<String>,
}
impl ListResourceTemplatesRequestParams {
pub fn new() -> Self {
Self { r#cursor: None }
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListResourceTemplatesRequest {
#[serde(rename = "params")]
pub r#params: Option<ListResourceTemplatesRequestParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl ListResourceTemplatesRequest {
pub const METHOD: &str = "resources/templates/list";
pub fn new() -> Self {
Self {
r#params: None,
r#method: "resources/templates/list".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListRootsRequestParamsMeta {
#[serde(rename = "progressToken")]
pub r#progress_token: Option<ProgressToken>,
}
impl ListRootsRequestParamsMeta {
pub fn new() -> Self {
Self {
r#progress_token: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListRootsRequestParams {
#[serde(rename = "_meta")]
pub r#meta: Option<ListRootsRequestParamsMeta>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl ListRootsRequestParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListRootsRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<ListRootsRequestParams>,
}
impl ListRootsRequest {
pub const METHOD: &str = "roots/list";
pub fn new() -> Self {
Self {
r#method: "roots/list".to_string(),
r#params: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ModelPreferences {
#[serde(rename = "costPriority")]
pub r#cost_priority: Option<f64>,
#[serde(rename = "hints")]
pub r#hints: Option<Vec<ModelHint>>,
#[serde(rename = "intelligencePriority")]
pub r#intelligence_priority: Option<f64>,
#[serde(rename = "speedPriority")]
pub r#speed_priority: Option<f64>,
}
impl ModelPreferences {
pub fn new() -> Self {
Self {
r#cost_priority: None,
r#hints: None,
r#intelligence_priority: None,
r#speed_priority: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PaginatedResult {
#[serde(rename = "nextCursor")]
pub r#next_cursor: Option<String>,
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
}
impl PaginatedResult {
pub fn new() -> Self {
Self {
r#next_cursor: None,
r#meta: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceReference {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "uri")]
pub r#uri: String,
}
impl ResourceReference {
pub const TYPE: &str = "ref/resource";
pub fn new(r#uri: String) -> Self {
Self {
r#type: "ref/resource".to_string(),
r#uri,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Result {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl Result {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum SamplingMessageContent {
TextContent(TextContent),
ImageContent(ImageContent),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct SamplingMessage {
#[serde(rename = "content")]
pub r#content: SamplingMessageContent,
#[serde(rename = "role")]
pub r#role: Role,
}
impl SamplingMessage {
pub fn new(r#content: SamplingMessageContent, r#role: Role) -> Self {
Self { r#content, r#role }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum CallToolResultContent {
TextContent(TextContent),
ImageContent(ImageContent),
EmbeddedResource(EmbeddedResource),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CallToolResult {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "isError")]
pub r#is_error: Option<bool>,
#[serde(rename = "content")]
pub r#content: Vec<CallToolResultContent>,
}
impl CallToolResult {
pub fn new(r#content: Vec<CallToolResultContent>) -> Self {
Self {
r#meta: None,
r#is_error: None,
r#content,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub enum RequestId {
String(String),
Integer(Integer),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct SubscribeRequestParams {
#[serde(rename = "uri")]
pub r#uri: String,
}
impl SubscribeRequestParams {
pub fn new(r#uri: String) -> Self {
Self { r#uri }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct SubscribeRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: SubscribeRequestParams,
}
impl SubscribeRequest {
pub const METHOD: &str = "resources/subscribe";
pub fn new(r#params: SubscribeRequestParams) -> Self {
Self {
r#method: "resources/subscribe".to_string(),
r#params,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceTemplateAnnotations {
#[serde(rename = "priority")]
pub r#priority: Option<f64>,
#[serde(rename = "audience")]
pub r#audience: Option<Vec<Role>>,
}
impl ResourceTemplateAnnotations {
pub fn new() -> Self {
Self {
r#priority: None,
r#audience: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceTemplate {
#[serde(rename = "annotations")]
pub r#annotations: Option<ResourceTemplateAnnotations>,
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "uriTemplate")]
pub r#uri_template: String,
#[serde(rename = "mimeType")]
pub r#mime_type: Option<String>,
#[serde(rename = "name")]
pub r#name: String,
}
impl ResourceTemplate {
pub fn new(r#uri_template: String, r#name: String) -> Self {
Self {
r#annotations: None,
r#description: None,
r#uri_template,
r#mime_type: None,
r#name,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct TextContentAnnotations {
#[serde(rename = "audience")]
pub r#audience: Option<Vec<Role>>,
#[serde(rename = "priority")]
pub r#priority: Option<f64>,
}
impl TextContentAnnotations {
pub fn new() -> Self {
Self {
r#audience: None,
r#priority: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct TextContent {
#[serde(rename = "text")]
pub r#text: String,
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "annotations")]
pub r#annotations: Option<TextContentAnnotations>,
}
impl TextContent {
pub const TYPE: &str = "text";
pub fn new(r#text: String) -> Self {
Self {
r#text,
r#type: "text".to_string(),
r#annotations: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct BlobResourceContents {
#[serde(rename = "mimeType")]
pub r#mime_type: Option<String>,
#[serde(rename = "blob")]
pub r#blob: String,
#[serde(rename = "uri")]
pub r#uri: String,
}
impl BlobResourceContents {
pub fn new(r#blob: String, r#uri: String) -> Self {
Self {
r#mime_type: None,
r#blob,
r#uri,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub enum LoggingLevel {
String(String),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct InitializeResult {
#[serde(rename = "serverInfo")]
pub r#server_info: Implementation,
#[serde(rename = "capabilities")]
pub r#capabilities: ServerCapabilities,
#[serde(rename = "instructions")]
pub r#instructions: Option<String>,
#[serde(rename = "protocolVersion")]
pub r#protocol_version: String,
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
}
impl InitializeResult {
pub fn new(
r#server_info: Implementation,
r#capabilities: ServerCapabilities,
r#protocol_version: String,
) -> Self {
Self {
r#server_info,
r#capabilities,
r#instructions: None,
r#protocol_version,
r#meta: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Root {
#[serde(rename = "name")]
pub r#name: Option<String>,
#[serde(rename = "uri")]
pub r#uri: String,
}
impl Root {
pub fn new(r#uri: String) -> Self {
Self {
r#name: None,
r#uri,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ClientResult {
Result(Result),
CreateMessageResult(CreateMessageResult),
ListRootsResult(ListRootsResult),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ProgressNotificationParams {
#[serde(rename = "total")]
pub r#total: Option<f64>,
#[serde(rename = "progress")]
pub r#progress: f64,
#[serde(rename = "progressToken")]
pub r#progress_token: ProgressToken,
}
impl ProgressNotificationParams {
pub fn new(r#progress: f64, r#progress_token: ProgressToken) -> Self {
Self {
r#total: None,
r#progress,
r#progress_token,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ProgressNotification {
#[serde(rename = "params")]
pub r#params: ProgressNotificationParams,
#[serde(rename = "method")]
pub r#method: String,
}
impl ProgressNotification {
pub const METHOD: &str = "notifications/progress";
pub fn new(r#params: ProgressNotificationParams) -> Self {
Self {
r#params,
r#method: "notifications/progress".to_string(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ReadResourceResultContents {
TextResourceContents(TextResourceContents),
BlobResourceContents(BlobResourceContents),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ReadResourceResult {
#[serde(rename = "contents")]
pub r#contents: Vec<ReadResourceResultContents>,
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
}
impl ReadResourceResult {
pub fn new(r#contents: Vec<ReadResourceResultContents>) -> Self {
Self {
r#contents,
r#meta: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ServerNotification {
CancelledNotification(CancelledNotification),
ProgressNotification(ProgressNotification),
ResourceListChangedNotification(ResourceListChangedNotification),
ResourceUpdatedNotification(ResourceUpdatedNotification),
PromptListChangedNotification(PromptListChangedNotification),
ToolListChangedNotification(ToolListChangedNotification),
LoggingMessageNotification(LoggingMessageNotification),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ToolInputSchema {
#[serde(rename = "required")]
pub r#required: Option<Vec<String>>,
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "properties")]
pub r#properties: Option<serde_json::Value>,
}
impl ToolInputSchema {
pub const TYPE: &str = "object";
pub fn new() -> Self {
Self {
r#required: None,
r#type: "object".to_string(),
r#properties: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Tool {
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "inputSchema")]
pub r#input_schema: ToolInputSchema,
#[serde(rename = "name")]
pub r#name: String,
}
impl Tool {
pub fn new(r#input_schema: ToolInputSchema, r#name: String) -> Self {
Self {
r#description: None,
r#input_schema,
r#name,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct GetPromptResult {
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "messages")]
pub r#messages: Vec<PromptMessage>,
}
impl GetPromptResult {
pub fn new(r#messages: Vec<PromptMessage>) -> Self {
Self {
r#description: None,
r#meta: None,
r#messages,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ClientNotification {
CancelledNotification(CancelledNotification),
InitializedNotification(InitializedNotification),
ProgressNotification(ProgressNotification),
RootsListChangedNotification(RootsListChangedNotification),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceAnnotations {
#[serde(rename = "priority")]
pub r#priority: Option<f64>,
#[serde(rename = "audience")]
pub r#audience: Option<Vec<Role>>,
}
impl ResourceAnnotations {
pub fn new() -> Self {
Self {
r#priority: None,
r#audience: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Resource {
#[serde(rename = "name")]
pub r#name: String,
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "uri")]
pub r#uri: String,
#[serde(rename = "mimeType")]
pub r#mime_type: Option<String>,
#[serde(rename = "annotations")]
pub r#annotations: Option<ResourceAnnotations>,
}
impl Resource {
pub fn new(r#name: String, r#uri: String) -> Self {
Self {
r#name,
r#description: None,
r#uri,
r#mime_type: None,
r#annotations: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCResponse {
#[serde(rename = "jsonrpc")]
pub r#jsonrpc: String,
#[serde(rename = "result")]
pub r#result: Result,
#[serde(rename = "id")]
pub r#id: RequestId,
}
impl JSONRPCResponse {
pub const JSONRPC: &str = "2.0";
pub fn new(r#result: Result, r#id: RequestId) -> Self {
Self {
r#jsonrpc: "2.0".to_string(),
r#result,
r#id,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum EmbeddedResourceResource {
TextResourceContents(TextResourceContents),
BlobResourceContents(BlobResourceContents),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct EmbeddedResourceAnnotations {
#[serde(rename = "audience")]
pub r#audience: Option<Vec<Role>>,
#[serde(rename = "priority")]
pub r#priority: Option<f64>,
}
impl EmbeddedResourceAnnotations {
pub fn new() -> Self {
Self {
r#audience: None,
r#priority: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct EmbeddedResource {
#[serde(rename = "resource")]
pub r#resource: EmbeddedResourceResource,
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "annotations")]
pub r#annotations: Option<EmbeddedResourceAnnotations>,
}
impl EmbeddedResource {
pub const TYPE: &str = "resource";
pub fn new(r#resource: EmbeddedResourceResource) -> Self {
Self {
r#resource,
r#type: "resource".to_string(),
r#annotations: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ClientCapabilitiesSampling {
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl ClientCapabilitiesSampling {
pub fn new() -> Self {
Self {
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ClientCapabilitiesRoots {
#[serde(rename = "listChanged")]
pub r#list_changed: Option<bool>,
}
impl ClientCapabilitiesRoots {
pub fn new() -> Self {
Self {
r#list_changed: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ClientCapabilities {
#[serde(rename = "sampling")]
pub r#sampling: Option<ClientCapabilitiesSampling>,
#[serde(rename = "experimental")]
pub r#experimental: Option<serde_json::Value>,
#[serde(rename = "roots")]
pub r#roots: Option<ClientCapabilitiesRoots>,
}
impl ClientCapabilities {
pub fn new() -> Self {
Self {
r#sampling: None,
r#experimental: None,
r#roots: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceUpdatedNotificationParams {
#[serde(rename = "uri")]
pub r#uri: String,
}
impl ResourceUpdatedNotificationParams {
pub fn new(r#uri: String) -> Self {
Self { r#uri }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceUpdatedNotification {
#[serde(rename = "params")]
pub r#params: ResourceUpdatedNotificationParams,
#[serde(rename = "method")]
pub r#method: String,
}
impl ResourceUpdatedNotification {
pub const METHOD: &str = "notifications/resources/updated";
pub fn new(r#params: ResourceUpdatedNotificationParams) -> Self {
Self {
r#params,
r#method: "notifications/resources/updated".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct AnnotatedAnnotations {
#[serde(rename = "priority")]
pub r#priority: Option<f64>,
#[serde(rename = "audience")]
pub r#audience: Option<Vec<Role>>,
}
impl AnnotatedAnnotations {
pub fn new() -> Self {
Self {
r#priority: None,
r#audience: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Annotated {
#[serde(rename = "annotations")]
pub r#annotations: Option<AnnotatedAnnotations>,
}
impl Annotated {
pub fn new() -> Self {
Self {
r#annotations: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ClientRequest {
InitializeRequest(InitializeRequest),
PingRequest(PingRequest),
ListResourcesRequest(ListResourcesRequest),
ListResourceTemplatesRequest(ListResourceTemplatesRequest),
ReadResourceRequest(ReadResourceRequest),
SubscribeRequest(SubscribeRequest),
UnsubscribeRequest(UnsubscribeRequest),
ListPromptsRequest(ListPromptsRequest),
GetPromptRequest(GetPromptRequest),
ListToolsRequest(ListToolsRequest),
CallToolRequest(CallToolRequest),
SetLevelRequest(SetLevelRequest),
CompleteRequest(CompleteRequest),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PaginatedRequestParams {
#[serde(rename = "cursor")]
pub r#cursor: Option<String>,
}
impl PaginatedRequestParams {
pub fn new() -> Self {
Self { r#cursor: None }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PaginatedRequest {
#[serde(rename = "params")]
pub r#params: Option<PaginatedRequestParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl PaginatedRequest {
pub fn new(r#method: String) -> Self {
Self {
r#params: None,
r#method,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CallToolRequestParams {
#[serde(rename = "arguments")]
pub r#arguments: Option<serde_json::Value>,
#[serde(rename = "name")]
pub r#name: String,
}
impl CallToolRequestParams {
pub fn new(r#name: String) -> Self {
Self {
r#arguments: None,
r#name,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct CallToolRequest {
#[serde(rename = "params")]
pub r#params: CallToolRequestParams,
#[serde(rename = "method")]
pub r#method: String,
}
impl CallToolRequest {
pub const METHOD: &str = "tools/call";
pub fn new(r#params: CallToolRequestParams) -> Self {
Self {
r#params,
r#method: "tools/call".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PingRequestParamsMeta {
#[serde(rename = "progressToken")]
pub r#progress_token: Option<ProgressToken>,
}
impl PingRequestParamsMeta {
pub fn new() -> Self {
Self {
r#progress_token: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PingRequestParams {
#[serde(rename = "_meta")]
pub r#meta: Option<PingRequestParamsMeta>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl PingRequestParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PingRequest {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<PingRequestParams>,
}
impl PingRequest {
pub const METHOD: &str = "ping";
pub fn new() -> Self {
Self {
r#method: "ping".to_string(),
r#params: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListRootsResult {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "roots")]
pub r#roots: Vec<Root>,
}
impl ListRootsResult {
pub fn new(r#roots: Vec<Root>) -> Self {
Self {
r#meta: None,
r#roots,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCRequestParamsMeta {
#[serde(rename = "progressToken")]
pub r#progress_token: Option<ProgressToken>,
}
impl JSONRPCRequestParamsMeta {
pub fn new() -> Self {
Self {
r#progress_token: None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCRequestParams {
#[serde(rename = "_meta")]
pub r#meta: Option<JSONRPCRequestParamsMeta>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl JSONRPCRequestParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCRequest {
#[serde(rename = "id")]
pub r#id: RequestId,
#[serde(rename = "params")]
pub r#params: Option<JSONRPCRequestParams>,
#[serde(rename = "jsonrpc")]
pub r#jsonrpc: String,
#[serde(rename = "method")]
pub r#method: String,
}
impl JSONRPCRequest {
pub const JSONRPC: &str = "2.0";
pub fn new(r#id: RequestId, r#method: String) -> Self {
Self {
r#id,
r#params: None,
r#jsonrpc: "2.0".to_string(),
r#method,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListResourcesResult {
#[serde(rename = "nextCursor")]
pub r#next_cursor: Option<String>,
#[serde(rename = "resources")]
pub r#resources: Vec<Resource>,
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
}
impl ListResourcesResult {
pub fn new(r#resources: Vec<Resource>) -> Self {
Self {
r#next_cursor: None,
r#resources,
r#meta: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub enum ProgressToken {
String(String),
Integer(Integer),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListResourcesRequestParams {
#[serde(rename = "cursor")]
pub r#cursor: Option<String>,
}
impl ListResourcesRequestParams {
pub fn new() -> Self {
Self { r#cursor: None }
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListResourcesRequest {
#[serde(rename = "params")]
pub r#params: Option<ListResourcesRequestParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl ListResourcesRequest {
pub const METHOD: &str = "resources/list";
pub fn new() -> Self {
Self {
r#params: None,
r#method: "resources/list".to_string(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct TextResourceContents {
#[serde(rename = "text")]
pub r#text: String,
#[serde(rename = "uri")]
pub r#uri: String,
#[serde(rename = "mimeType")]
pub r#mime_type: Option<String>,
}
impl TextResourceContents {
pub fn new(r#text: String, r#uri: String) -> Self {
Self {
r#text,
r#uri,
r#mime_type: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct Implementation {
#[serde(rename = "version")]
pub r#version: String,
#[serde(rename = "name")]
pub r#name: String,
}
impl Implementation {
pub fn new(r#version: String, r#name: String) -> Self {
Self { r#version, r#name }
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCErrorError {
#[serde(rename = "data")]
pub r#data: Option<serde_json::Value>,
#[serde(rename = "message")]
pub r#message: String,
#[serde(rename = "code")]
pub r#code: Integer,
}
impl JSONRPCErrorError {
pub fn new(r#message: String, r#code: Integer) -> Self {
Self {
r#data: None,
r#message,
r#code,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCError {
#[serde(rename = "error")]
pub r#error: JSONRPCErrorError,
#[serde(rename = "id")]
pub r#id: RequestId,
#[serde(rename = "jsonrpc")]
pub r#jsonrpc: String,
}
impl JSONRPCError {
pub const JSONRPC: &str = "2.0";
pub fn new(r#error: JSONRPCErrorError, r#id: RequestId) -> Self {
Self {
r#error,
r#id,
r#jsonrpc: "2.0".to_string(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub enum Role {
String(String),
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCNotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl JSONRPCNotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct JSONRPCNotification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<JSONRPCNotificationParams>,
#[serde(rename = "jsonrpc")]
pub r#jsonrpc: String,
}
impl JSONRPCNotification {
pub const JSONRPC: &str = "2.0";
pub fn new(r#method: String) -> Self {
Self {
r#method,
r#params: None,
r#jsonrpc: "2.0".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceListChangedNotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl ResourceListChangedNotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ResourceListChangedNotification {
#[serde(rename = "method")]
pub r#method: String,
#[serde(rename = "params")]
pub r#params: Option<ResourceListChangedNotificationParams>,
}
impl ResourceListChangedNotification {
pub const METHOD: &str = "notifications/resources/list_changed";
pub fn new() -> Self {
Self {
r#method: "notifications/resources/list_changed".to_string(),
r#params: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ListResourceTemplatesResult {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(rename = "nextCursor")]
pub r#next_cursor: Option<String>,
#[serde(rename = "resourceTemplates")]
pub r#resource_templates: Vec<ResourceTemplate>,
}
impl ListResourceTemplatesResult {
pub fn new(r#resource_templates: Vec<ResourceTemplate>) -> Self {
Self {
r#meta: None,
r#next_cursor: None,
r#resource_templates,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct InitializedNotificationParams {
#[serde(rename = "_meta")]
pub r#meta: Option<serde_json::Value>,
#[serde(flatten)]
pub additional_properties: HashMap<String, serde_json::Value>,
}
impl InitializedNotificationParams {
pub fn new() -> Self {
Self {
r#meta: None,
additional_properties: HashMap::new(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct InitializedNotification {
#[serde(rename = "params")]
pub r#params: Option<InitializedNotificationParams>,
#[serde(rename = "method")]
pub r#method: String,
}
impl InitializedNotification {
pub const METHOD: &str = "notifications/initialized";
pub fn new() -> Self {
Self {
r#params: None,
r#method: "notifications/initialized".to_string(),
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ModelHint {
#[serde(rename = "name")]
pub r#name: Option<String>,
}
impl ModelHint {
pub fn new() -> Self {
Self { r#name: None }
}
}