MCPcopy Index your code
hub / github.com/IBM/AssetOpsBench / _make_stdio_params

Function _make_stdio_params

src/agent/plan_execute/executor.py:257–281  ·  view source on GitHub ↗

Build StdioServerParameters for a server spec. - str → entry-point name; invoked as ``uv run `` from the repo root. - Path → invoked as ``python -m module.path`` when under the repo root (supports relative imports), or directly otherwise.

(server: Path | str)

Source from the content-addressed store, hash-verified

255
256
257def _make_stdio_params(server: Path | str) -> "StdioServerParameters":
258 """Build StdioServerParameters for a server spec.
259
260 - str → entry-point name; invoked as ``uv run <name>`` from the repo root.
261 - Path → invoked as ``python -m module.path`` when under the repo root
262 (supports relative imports), or directly otherwise.
263 """
264 from mcp import StdioServerParameters
265
266 if isinstance(server, str):
267 return StdioServerParameters(
268 command="uv",
269 args=["run", server],
270 cwd=str(_REPO_ROOT),
271 )
272 try:
273 rel = server.relative_to(_REPO_ROOT)
274 module = str(rel.with_suffix("")).replace("/", ".").replace("\\", ".")
275 return StdioServerParameters(
276 command="python",
277 args=["-m", module],
278 cwd=str(_REPO_ROOT),
279 )
280 except ValueError:
281 return StdioServerParameters(command="python", args=[str(server)])
282
283
284async def _list_tools(server_path: Path | str) -> list[dict]:

Callers 2

_list_toolsFunction · 0.85
_call_toolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected