This commit is contained in:
Ubuntu
2026-01-31 16:03:17 +00:00
parent 3c71d5da0a
commit dd7bbd1f9a
2 changed files with 13 additions and 3 deletions

View File

@@ -10,7 +10,13 @@ class MCPTool(BaseModel):
name: str = Field(..., description="Unique tool identifier")
description: str = Field(..., description="Human-readable tool description")
input_schema: Dict[str, Any] = Field(..., description="JSON Schema for tool input")
input_schema: Dict[str, Any] = Field(
..., alias="inputSchema", description="JSON Schema for tool input"
)
class Config:
populate_by_name = True
by_alias = True
class MCPToolCallRequest(BaseModel):

View File

@@ -167,7 +167,7 @@ async def list_tools() -> JSONResponse:
JSON response with list of tool definitions
"""
response = MCPListToolsResponse(tools=AVAILABLE_TOOLS)
return JSONResponse(content=response.model_dump())
return JSONResponse(content=response.model_dump(by_alias=True))
@app.post("/mcp/tool/call")
@@ -336,7 +336,11 @@ async def sse_message_handler(request: Request) -> JSONResponse:
# Return the list of available tools
response = MCPListToolsResponse(tools=AVAILABLE_TOOLS)
return JSONResponse(
content={"jsonrpc": "2.0", "id": message_id, "result": response.model_dump()}
content={
"jsonrpc": "2.0",
"id": message_id,
"result": response.model_dump(by_alias=True),
}
)
elif message_type == "tools/call":