Skip to content

Commit 606b9bc

Browse files
committed
fixed tools metadata and some other changes
1 parent 8026611 commit 606b9bc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

__init__

Whitespace-only changes.

mcpgateway/wrapper2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ async def tools_metadata(tool_ids: List[str]) -> List[Dict[str, Any]]:
191191
data: List[Dict[str, Any]] = response.json()
192192
if tool_ids == ["0"]:
193193
return data
194-
return [tool for tool in data if str(tool.get("id")) in tool_ids]
194+
195+
return [tool for tool in data if tool["id"] in tool_ids]
195196

196197

197198
async def get_prompts_from_mcp_server(catalog_urls: List[str]) -> List[str]:
@@ -313,7 +314,7 @@ async def handle_list_tools() -> List[types.Tool]:
313314
RuntimeError: If an error occurs during fetching or processing.
314315
"""
315316
try:
316-
tool_ids = ["0"] if not SERVER_CATALOG_URLS else await get_tools_from_mcp_server(SERVER_CATALOG_URLS)
317+
tool_ids = ["0"] if SERVER_CATALOG_URLS[0]==BASE_URL else await get_tools_from_mcp_server(SERVER_CATALOG_URLS)
317318
metadata = await tools_metadata(tool_ids)
318319
tools = []
319320
for tool in metadata:
@@ -392,7 +393,7 @@ async def handle_list_resources() -> List[types.Resource]:
392393
RuntimeError: If an error occurs during fetching or processing.
393394
"""
394395
try:
395-
ids = ["0"] if not SERVER_CATALOG_URLS else await get_resources_from_mcp_server(SERVER_CATALOG_URLS)
396+
ids = ["0"] if SERVER_CATALOG_URLS[0]==BASE_URL else await get_resources_from_mcp_server(SERVER_CATALOG_URLS)
396397
meta = await resources_metadata(ids)
397398
resources = []
398399
for r in meta:
@@ -455,7 +456,7 @@ async def handle_list_prompts() -> List[types.Prompt]:
455456
RuntimeError: If an error occurs during fetching or processing.
456457
"""
457458
try:
458-
ids = ["0"] if not SERVER_CATALOG_URLS else await get_prompts_from_mcp_server(SERVER_CATALOG_URLS)
459+
ids = ["0"] if SERVER_CATALOG_URLS[0]==BASE_URL else await get_prompts_from_mcp_server(SERVER_CATALOG_URLS)
459460
meta = await prompts_metadata(ids)
460461
prompts = []
461462
for p in meta:

0 commit comments

Comments
 (0)