poem_mcpserver/protocol/
tool.rs1use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6use crate::protocol::content::Content;
7
8#[derive(Debug, Deserialize, Default)]
10#[serde(rename_all = "camelCase")]
11pub struct ToolsListRequest {
12 pub cursor: Option<String>,
14}
15
16#[derive(Debug, Serialize)]
18#[serde(rename_all = "camelCase")]
19pub struct Tool {
20 pub name: &'static str,
22 pub description: &'static str,
24 pub input_schema: Value,
26 #[serde(skip_serializing_if = "Option::is_none")]
28 pub output_schema: Option<Value>,
29}
30
31#[derive(Debug, Serialize)]
33#[serde(rename_all = "camelCase")]
34pub struct ToolsListResponse {
35 pub tools: Vec<Tool>,
37}
38
39#[derive(Debug, Deserialize)]
41#[serde(rename_all = "camelCase")]
42pub struct ToolsCallRequest {
43 pub name: String,
45 #[serde(default)]
46 pub arguments: Value,
48}
49
50#[derive(Debug, Serialize)]
52#[serde(rename_all = "camelCase")]
53pub struct ToolsCallResponse {
54 pub content: Vec<Content>,
56 #[serde(skip_serializing_if = "Option::is_none")]
58 pub structured_content: Option<Value>,
59 pub is_error: bool,
61}