Skip to main content
Glama

Math Operations MCP Server

by iamkhanwasim
MIT License
  • Apple
  • Linux
add.py1.03 kB
from fastapi import APIRouter from pydantic import BaseModel router = APIRouter() class AddRequest(BaseModel): a: float b: float class Config: json_schema_extra = { "example": { "a": 10.5, "b": 5.5 } } class AddResponse(BaseModel): result: float operation: str inputs: dict class Config: json_schema_extra = { "example": { "result": 16.0, "operation": "addition", "inputs": {"a": 10.5, "b": 5.5} } } @router.post("/add", response_model=AddResponse) def add_numbers(request: AddRequest): """ Add two numbers together. Args: request: AddRequest containing two numbers 'a' and 'b' Returns: AddResponse with the sum of a and b """ result = request.a + request.b return AddResponse( result=result, operation="addition", inputs={"a": request.a, "b": request.b} )

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iamkhanwasim/mcp-fastapi'

If you have feedback or need assistance with the MCP directory API, please join our Discord server