asimov_server/http/mcp/
provider.rs1use rmcp::model::{
4 Annotated, Content, Implementation, Prompt, PromptMessage, ProtocolVersion, RawResource,
5 ResourceContents, ResourceTemplate, ServerCapabilities, Tool,
6};
7use serde_json::{Map, Value};
8
9#[async_trait::async_trait]
10pub trait Provider {
11 type Error;
12
13 fn protocol_version(&self) -> ProtocolVersion;
14 fn capabilities(&self) -> ServerCapabilities;
15 fn implementation(&self) -> Implementation;
16
17 async fn list_prompts(
18 &self,
19 page: Option<String>,
20 ) -> Result<(Vec<Prompt>, Option<String>), Self::Error>;
21 async fn get_prompt(
22 &self,
23 name: String,
24 arguments: Option<Map<String, Value>>,
25 ) -> Result<(Vec<PromptMessage>, Option<String>), Self::Error>;
26
27 async fn list_resources(
28 &self,
29 page: Option<String>,
30 ) -> Result<(Vec<Annotated<RawResource>>, Option<String>), Self::Error>;
31 async fn list_resource_templates(
32 &self,
33 page: Option<String>,
34 ) -> Result<(Vec<ResourceTemplate>, Option<String>), Self::Error>;
35 async fn read_resource(&self, uri: &str) -> Result<Vec<ResourceContents>, Self::Error>;
36
37 async fn list_tools(
38 &self,
39 page: Option<String>,
40 ) -> Result<(Vec<Tool>, Option<String>), Self::Error>;
41 async fn call_tool(
42 &self,
43 name: &str,
44 arguments: Option<Map<String, Value>>,
45 ) -> Result<(Vec<Content>, Option<bool>), Self::Error>;
46}