-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathtool_groups.py
More file actions
45 lines (40 loc) · 1.25 KB
/
tool_groups.py
File metadata and controls
45 lines (40 loc) · 1.25 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
44
45
"""
tool_groups resource – exposes available tool groups and their metadata.
URI: mcpforunity://tool-groups
"""
from typing import Any
from fastmcp import Context
from services.registry import (
mcp_for_unity_resource,
TOOL_GROUPS,
DEFAULT_ENABLED_GROUPS,
get_group_tool_names,
)
@mcp_for_unity_resource(
uri="mcpforunity://tool-groups",
name="tool_groups",
unity_target=False,
description=(
"Available tool groups and their tools. "
"Use manage_tools to activate/deactivate groups per session.\n\n"
"URI: mcpforunity://tool-groups"
),
)
async def get_tool_groups(ctx: Context) -> dict[str, Any]:
group_tools = get_group_tool_names()
groups = []
for name in sorted(TOOL_GROUPS.keys()):
tools = group_tools.get(name, [])
groups.append({
"name": name,
"description": TOOL_GROUPS[name],
"default_enabled": name in DEFAULT_ENABLED_GROUPS,
"tools": tools,
"tool_count": len(tools),
})
return {
"groups": groups,
"total_groups": len(groups),
"default_enabled": sorted(DEFAULT_ENABLED_GROUPS),
"usage": "Call manage_tools(action='activate', group='<name>') to enable a group.",
}