Skip to main content

objectiveai_sdk/mcp/resource/
resource.rs

1//! MCP Resource definition.
2
3use indexmap::IndexMap;
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7/// A known resource that the server is capable of reading.
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
9#[schemars(rename = "mcp.resource.Resource")]
10pub struct Resource {
11    /// The programmatic name of the resource.
12    pub name: String,
13    /// A human-readable display name.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    #[schemars(extend("omitempty" = true))]
16    pub title: Option<String>,
17    /// The URI of this resource.
18    pub uri: String,
19    /// A description of what this resource represents.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    #[schemars(extend("omitempty" = true))]
22    pub description: Option<String>,
23    /// The MIME type of this resource, if known.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    #[schemars(extend("omitempty" = true))]
26    #[serde(rename = "mimeType")]
27    pub mime_type: Option<String>,
28    /// Icons for the resource.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    #[schemars(extend("omitempty" = true))]
31    pub icons: Option<Vec<super::super::shared::Icon>>,
32    /// Optional annotations for the client.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    #[schemars(extend("omitempty" = true))]
35    pub annotations: Option<super::super::shared::Annotations>,
36    /// Extension metadata.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    #[schemars(extend("omitempty" = true))]
39    pub _meta: Option<IndexMap<String, serde_json::Value>>,
40}