fast-agent-mcp 0.2.27__py3-none-any.whl → 0.2.28__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,9 +70,15 @@ class ServerRegistry:
70
70
  config (Settings): The Settings object containing the server configurations.
71
71
  config_path (str): Path to the YAML configuration file.
72
72
  """
73
- self.registry = (
74
- self.load_registry_from_file(config_path) if config is None else config.mcp.servers
75
- )
73
+ if config is None:
74
+ self.registry = self.load_registry_from_file(config_path)
75
+ elif config.mcp is not None and hasattr(config.mcp, 'servers') and config.mcp.servers is not None:
76
+ # Ensure config.mcp exists, has a 'servers' attribute, and it's not None
77
+ self.registry = config.mcp.servers
78
+ else:
79
+ # Default to an empty dictionary if config.mcp is None or has no 'servers'
80
+ self.registry = {}
81
+
76
82
  self.init_hooks: Dict[str, InitHookCallable] = {}
77
83
  self.connection_manager = MCPConnectionManager(self)
78
84
 
@@ -88,8 +94,13 @@ class ServerRegistry:
88
94
  Raises:
89
95
  ValueError: If the configuration is invalid.
90
96
  """
97
+ servers = {}
91
98
 
92
- servers = get_settings(config_path).mcp.servers or {}
99
+ settings = get_settings(config_path)
100
+
101
+ if settings.mcp is not None and hasattr(settings.mcp, 'servers') and settings.mcp.servers is not None:
102
+ return settings.mcp.servers
103
+
93
104
  return servers
94
105
 
95
106
  @asynccontextmanager
@@ -0,0 +1,14 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Any, Dict, Optional
3
+
4
+
5
+ @dataclass
6
+ class ToolDefinition:
7
+ """
8
+ Represents a definition of a tool available to the agent.
9
+ """
10
+
11
+ name: str
12
+ description: Optional[str] = None
13
+ inputSchema: Dict[str, Any] = field(default_factory=dict)
14
+ # Add other relevant fields if necessary based on how tools are defined in fast-agent