|
1 | 1 | use crate::mcp::model::mcp::{ |
2 | | - McpQueryParam, McpServer, McpServerDto, McpServerParam, ToolSpec, ToolSpecParam, |
| 2 | + McpQueryParam, McpServer, McpServerDto, McpServerParam, |
3 | 3 | }; |
4 | 4 | use actix::Message; |
5 | 5 | use serde::{Deserialize, Serialize}; |
6 | 6 | use std::sync::Arc; |
| 7 | +use crate::mcp::model::tools::{ToolSpec, ToolSpecParam}; |
7 | 8 |
|
8 | 9 | /// MCP 查询请求 |
9 | 10 | #[derive(Debug, Message)] |
@@ -60,27 +61,28 @@ pub struct McpToolSpecQueryParam { |
60 | 61 | #[derive(Clone, Debug, Serialize, Deserialize)] |
61 | 62 | #[serde(rename_all = "camelCase")] |
62 | 63 | pub struct ToolSpecDto { |
63 | | - pub namespace: String, |
64 | | - pub group: String, |
65 | | - pub tool_name: String, |
| 64 | + pub namespace: Arc<String>, |
| 65 | + pub group: Arc<String>, |
| 66 | + pub tool_name: Arc<String>, |
66 | 67 | pub version: u64, |
67 | 68 | pub name: String, |
68 | 69 | pub description: String, |
69 | | - pub create_time: u64, |
70 | | - pub last_modified_millis: u64, |
| 70 | + pub create_time: i64, |
| 71 | + pub last_modified_millis: i64, |
71 | 72 | } |
72 | 73 |
|
73 | 74 | impl ToolSpecDto { |
74 | 75 | pub fn new_from(tool_spec: &ToolSpec) -> Self { |
| 76 | + let current_version = tool_spec.get_current_version().unwrap_or_default(); |
75 | 77 | Self { |
76 | | - namespace: tool_spec.key.namespace.to_string(), |
77 | | - group: tool_spec.key.group.to_string(), |
78 | | - tool_name: tool_spec.key.tool_name.to_string(), |
79 | | - version: tool_spec.version, |
80 | | - name: tool_spec.name.to_string(), |
81 | | - description: tool_spec.description.to_string(), |
82 | | - create_time: 0, // 实际实现中需要从 tool_spec 获取 |
83 | | - last_modified_millis: 0, // 实际实现中需要从 tool_spec 获取 |
| 78 | + namespace: tool_spec.key.namespace.clone(), |
| 79 | + group: tool_spec.key.group.clone(), |
| 80 | + tool_name: tool_spec.key.tool_name.clone(), |
| 81 | + version: tool_spec.current_version, |
| 82 | + name: current_version.parameters.name.clone(), |
| 83 | + description: current_version.parameters.name.clone(), |
| 84 | + create_time: 0, // 实际实现中需要从 tool_spec 获取 |
| 85 | + last_modified_millis: current_version.update_time, // 实际实现中需要从 tool_spec 获取 |
84 | 86 | } |
85 | 87 | } |
86 | 88 | } |
0 commit comments