-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_json.py
More file actions
43 lines (32 loc) · 1.15 KB
/
gen_json.py
File metadata and controls
43 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import json
import os
import sys
sys.path.append(os.getcwd())
from src.agent.tools import ALL_TOOLS
def generate_mcp_json():
tools_data = []
for tool in ALL_TOOLS:
args_list = []
if tool.args_schema:
schema = tool.args_schema.schema()
properties = schema.get("properties", {})
required = schema.get("required", [])
for arg_name, arg_info in properties.items():
if arg_name == "runtime":
continue
args_list.append({
"name": arg_name,
"type": arg_info.get("type", "string"),
"description": arg_info.get("description", ""),
"required": arg_name in required
})
tools_data.append({
"name": tool.name,
"description": tool.description,
"args": args_list
})
with open("mcp_tools.json", "w", encoding="utf-8") as f:
json.dump(tools_data, f, indent=2, ensure_ascii=False)
print(f"mcp_tools.json generated with {len(tools_data)} tools.")
if __name__ == "__main__":
generate_mcp_json()