Skip to content

fix(mcp): pass tool arguments to endpoint request#693

Open
sarvesh1327 wants to merge 3 commits into
Lightning-AI:mainfrom
sarvesh1327:fix/mcp-tools-call-request
Open

fix(mcp): pass tool arguments to endpoint request#693
sarvesh1327 wants to merge 3 commits into
Lightning-AI:mainfrom
sarvesh1327:fix/mcp-tools-call-request

Conversation

@sarvesh1327

Copy link
Copy Markdown

Summary

  • Fix MCP tools/call dispatch for endpoint handlers whose single request parameter is named request while MCP arguments are provided as direct tool inputs.
  • Coerce direct MCP arguments into Pydantic request models when possible, and provide a small request adapter for untyped LitAPI handlers that expect a FastAPI Request.
  • Add regression coverage for direct dict arguments, Pydantic request construction, and Request-style JSON payload handling.

Test Plan

  • uv run --project /Users/clawuser/workspace/opensource/2026-06-03/Lightning-AI_LitServe --with-editable /Users/clawuser/workspace/opensource/2026-06-03/Lightning-AI_LitServe --with pytest --with pytest-asyncio --with fastmcp pytest -q /Users/clawuser/workspace/opensource/2026-06-03/Lightning-AI_LitServe/tests/unit/test_mcp.py
  • uv run --project /Users/clawuser/workspace/opensource/2026-06-03/Lightning-AI_LitServe --with ruff ruff check /Users/clawuser/workspace/opensource/2026-06-03/Lightning-AI_LitServe/src/litserve/mcp.py /Users/clawuser/workspace/opensource/2026-06-03/Lightning-AI_LitServe/tests/unit/test_mcp.py

Closes #560

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LitServe MCP Bug: tools/call Always Fails

1 participant