diff --git a/src/aegis_gitea_mcp/mcp_protocol.py b/src/aegis_gitea_mcp/mcp_protocol.py index d340a9c..010cf91 100644 --- a/src/aegis_gitea_mcp/mcp_protocol.py +++ b/src/aegis_gitea_mcp/mcp_protocol.py @@ -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): diff --git a/src/aegis_gitea_mcp/server.py b/src/aegis_gitea_mcp/server.py index 1cab8e5..27bb160 100644 --- a/src/aegis_gitea_mcp/server.py +++ b/src/aegis_gitea_mcp/server.py @@ -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":