Skip to main content

stynx_code_tools/infrastructure/
list_mcp_resources_tool.rs

1use stynx_code_errors::AppResult;
2use stynx_code_types::{PermissionLevel, SearchReadInfo, Tool};
3use serde_json::{Value, json};
4
5pub struct ListMcpResourcesTool;
6
7impl ListMcpResourcesTool {
8    pub fn new() -> Self {
9        Self
10    }
11}
12
13#[async_trait::async_trait]
14impl Tool for ListMcpResourcesTool {
15    fn name(&self) -> &str {
16        "list_mcp_resources"
17    }
18
19    fn description(&self) -> &str {
20        "List available MCP resources, optionally filtered by server name."
21    }
22
23    fn input_schema(&self) -> Value {
24        json!({
25            "type": "object",
26            "properties": {
27                "server_name": {
28                    "type": "string",
29                    "description": "Optional MCP server name to filter resources"
30                }
31            }
32        })
33    }
34
35    fn permission_level(&self) -> PermissionLevel {
36        PermissionLevel::ReadOnly
37    }
38
39    fn is_read_only(&self, _input: &Value) -> bool { true }
40    fn is_mcp(&self) -> bool { true }
41    fn is_concurrent_safe(&self, _input: &Value) -> bool { true }
42
43    fn is_search_or_read_command(&self, _input: &Value) -> SearchReadInfo {
44        SearchReadInfo { is_search: false, is_read: false, is_list: true }
45    }
46
47    async fn execute(&self, input: Value) -> AppResult<String> {
48        let server_name = input.get("server_name").and_then(|v| v.as_str());
49
50        tracing::info!(?server_name, "listing MCP resources (stub)");
51
52        let result = json!({
53            "resources": [],
54            "server_name": server_name,
55            "message": "MCP integration not yet available. Will be implemented in Phase 4."
56        });
57
58        Ok(result.to_string())
59    }
60}