Skip to content

Commit 6682440

Browse files
committed
added list tools
1 parent 97dd27b commit 6682440

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "chuk-tool-processor"
7-
version = "0.1.5"
7+
version = "0.1.6"
88
description = "Add your description here"
99
readme = "README.md"
1010
requires-python = ">=3.11"

src/chuk_tool_processor/mcp/stream_manager.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,34 @@ def get_server_for_tool(self, tool_name: str) -> Optional[str]:
174174

175175
def get_server_info(self) -> List[Dict[str, Any]]:
176176
return self.server_info
177+
178+
async def list_tools(self, server_name: str) -> List[Dict[str, Any]]:
179+
"""
180+
List all tools available from a specific server.
181+
182+
This method is required by ProxyServerManager for proper tool discovery.
183+
184+
Args:
185+
server_name: Name of the server to query
186+
187+
Returns:
188+
List of tool definitions from the server
189+
"""
190+
if server_name not in self.transports:
191+
logger.error(f"Server '{server_name}' not found in transports")
192+
return []
193+
194+
# Get the transport for this server
195+
transport = self.transports[server_name]
196+
197+
try:
198+
# Call the get_tools method on the transport
199+
tools = await transport.get_tools()
200+
logger.debug(f"Found {len(tools)} tools for server {server_name}")
201+
return tools
202+
except Exception as e:
203+
logger.error(f"Error listing tools for server {server_name}: {e}")
204+
return []
177205

178206
# ------------------------------------------------------------------ #
179207
# EXTRA HELPERS – ping / resources / prompts #

0 commit comments

Comments
 (0)