IT WORKS
This commit is contained in:
@@ -10,7 +10,13 @@ class MCPTool(BaseModel):
|
|||||||
|
|
||||||
name: str = Field(..., description="Unique tool identifier")
|
name: str = Field(..., description="Unique tool identifier")
|
||||||
description: str = Field(..., description="Human-readable tool description")
|
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):
|
class MCPToolCallRequest(BaseModel):
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ async def list_tools() -> JSONResponse:
|
|||||||
JSON response with list of tool definitions
|
JSON response with list of tool definitions
|
||||||
"""
|
"""
|
||||||
response = MCPListToolsResponse(tools=AVAILABLE_TOOLS)
|
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")
|
@app.post("/mcp/tool/call")
|
||||||
@@ -336,7 +336,11 @@ async def sse_message_handler(request: Request) -> JSONResponse:
|
|||||||
# Return the list of available tools
|
# Return the list of available tools
|
||||||
response = MCPListToolsResponse(tools=AVAILABLE_TOOLS)
|
response = MCPListToolsResponse(tools=AVAILABLE_TOOLS)
|
||||||
return JSONResponse(
|
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":
|
elif message_type == "tools/call":
|
||||||
|
|||||||
Reference in New Issue
Block a user