|
11 | 11 | # These are the function types we want to discover |
12 | 12 | from fastmcp.tools import Tool |
13 | 13 |
|
| 14 | +import mcpserver.defaults as defaults |
| 15 | +import mcpserver.tools.system as systems |
| 16 | + |
14 | 17 | from .base import BaseTool |
15 | 18 |
|
16 | 19 |
|
@@ -104,13 +107,20 @@ def discover_tools(self, root_path: str, module_path: str) -> Dict[str, Path]: |
104 | 107 | discovered[tool_id] = {"path": file_path, "module": import_path, "root": root_path} |
105 | 108 | return discovered |
106 | 109 |
|
107 | | - def load_tools(self, mcp, include=None, exclude=None, status_tool: str = None): |
| 110 | + def load_tools(self, mcp, include=None, exclude=None, system_type="generic"): |
108 | 111 | """ |
109 | 112 | Load a set of named tools, or default to all those discovered. |
110 | 113 | """ |
111 | | - # Start with the system status tool |
112 | | - status_tool = status_tool or "mcpserver.tools.system.tool" |
113 | | - self.tools["system"] = {"module": status_tool} |
| 114 | + if system_type in systems.system_tools: |
| 115 | + # Map short name to internal library path |
| 116 | + sys_module = f"mcpserver.tools.system.{system_type}" |
| 117 | + else: |
| 118 | + # Assume it is a custom external module path provided by the user |
| 119 | + # e.g., 'my_custom_package.system_logic' |
| 120 | + sys_module = system_type |
| 121 | + |
| 122 | + # Seed the system tool into discovery |
| 123 | + self.tools["system"] = {"module": sys_module} |
114 | 124 |
|
115 | 125 | # If no tools are selected... select all tools discovered |
116 | 126 | names = self.tools |
@@ -199,13 +209,13 @@ def get_available_prompts(self): |
199 | 209 | """ |
200 | 210 | prompts = set() |
201 | 211 |
|
202 | | - # 2. Load them (to execute decorators) |
| 212 | + # Load them (to execute decorators) |
203 | 213 | for tool_id, path in self.tools.items(): |
204 | 214 | mod = self.load_tool_module(tool_id, path) |
205 | 215 | if not mod: |
206 | 216 | continue |
207 | 217 |
|
208 | | - # 3. Inspect the classes/functions in the module |
| 218 | + # Inspect the classes/functions in the module |
209 | 219 | for name, obj in inspect.getmembers(mod): |
210 | 220 | # We usually look for classes inheriting from BaseTool |
211 | 221 | # But we can also just scan the class attributes |
|
0 commit comments