Skip to content

Commit 55056b6

Browse files
committed
refactor: rename command and improve tool list structure
1 parent 812c1f8 commit 55056b6

File tree

1 file changed

+8
-6
lines changed
  • src/datapilot/core/mcp_utils

1 file changed

+8
-6
lines changed

src/datapilot/core/mcp_utils/mcp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from mcp.client.stdio import stdio_client
88
import click
99

10-
1110
logging.basicConfig(level=logging.INFO)
1211

1312
# New mcp group
@@ -16,7 +15,7 @@ def mcp():
1615
"""mcp specific commands."""
1716

1817

19-
@mcp.command("create-mcp-proxy")
18+
@mcp.command("inspect-mcp-server")
2019
def create_mcp_proxy():
2120
content = click.edit()
2221
if content is None:
@@ -31,7 +30,7 @@ def create_mcp_proxy():
3130

3231
inputs = {}
3332
mcp_config = config.get("mcp", {})
34-
33+
3534
# Process inputs first
3635
for input_def in mcp_config.get("inputs", []):
3736
input_id = input_def["id"]
@@ -45,7 +44,7 @@ def create_mcp_proxy():
4544
for server_name, server_config in servers.items():
4645
# Replace input tokens in args
4746
processed_args = [
48-
inputs.get(arg[8:-1], arg) if isinstance(arg, str) and arg.startswith("${input:") else arg
47+
inputs.get(arg[8:-1], arg) if isinstance(arg, str) and arg.startswith("${input:") else arg
4948
for arg in server_config.get("args", [])
5049
]
5150

@@ -74,12 +73,12 @@ async def list_tools(command: str, args: list[str], env: dict[str, str]):
7473
args=args,
7574
env=env, # Now using processed env
7675
)
77-
76+
7877
async with stdio_client(server_params) as (read, write):
7978
async with ClientSession(read, write) as session:
8079
await session.initialize()
8180
tools = await session.list_tools()
82-
return [
81+
mcp_tools = [
8382
{
8483
"name": tool.name,
8584
"description": tool.description,
@@ -88,3 +87,6 @@ async def list_tools(command: str, args: list[str], env: dict[str, str]):
8887
for tool in tools.tools
8988
]
9089

90+
return {
91+
"tools": mcp_tools,
92+
}

0 commit comments

Comments
 (0)