Skip to main content

convergio_knowledge/
mcp_defs.rs

1//! MCP tool definitions for the knowledge extension.
2
3use convergio_types::extension::McpToolDef;
4use serde_json::json;
5
6pub fn knowledge_tools() -> Vec<McpToolDef> {
7    vec![
8        McpToolDef {
9            name: "cvg_knowledge_search".into(),
10            description: "Search the vector knowledge store with semantic similarity.".into(),
11            method: "POST".into(),
12            path: "/api/knowledge/search".into(),
13            input_schema: json!({
14                "type": "object",
15                "properties": {
16                    "query": {
17                        "type": "string",
18                        "description": "Search query text"
19                    },
20                    "limit": {
21                        "type": "integer",
22                        "description": "Max results (default 5)"
23                    },
24                    "org_id": {
25                        "type": "string",
26                        "description": "Filter by organization"
27                    },
28                    "source_type": {
29                        "type": "string",
30                        "description": "Filter by source: task, commit, doc, agent_memory, kb"
31                    },
32                    "project_id": {
33                        "type": "string",
34                        "description": "Filter by project/repo (e.g. 'convergio', 'istitutodeimpresa')"
35                    }
36                },
37                "required": ["query"]
38            }),
39            min_ring: "sandboxed".into(),
40            path_params: vec![],
41        },
42        McpToolDef {
43            name: "cvg_knowledge_write".into(),
44            description: "Write an entry to the vector knowledge store.".into(),
45            method: "POST".into(),
46            path: "/api/knowledge/write".into(),
47            input_schema: json!({
48                "type": "object",
49                "properties": {
50                    "content": {
51                        "type": "string",
52                        "description": "Text content to embed and store"
53                    },
54                    "source_type": {
55                        "type": "string",
56                        "description": "Source type: task, commit, doc, agent_memory, kb"
57                    },
58                    "source_id": {
59                        "type": "string",
60                        "description": "Source identifier (task_id, commit hash, etc.)"
61                    },
62                    "org_id": {
63                        "type": "string",
64                        "description": "Organization scope"
65                    },
66                    "agent_id": {
67                        "type": "string",
68                        "description": "Agent that produced this knowledge"
69                    },
70                    "project_id": {
71                        "type": "string",
72                        "description": "Project/repo scope (e.g. 'convergio')"
73                    }
74                },
75                "required": ["content", "source_type", "source_id"]
76            }),
77            min_ring: "trusted".into(),
78            path_params: vec![],
79        },
80    ]
81}