Skip to main content
Glama

Multi-Agent Tools Platform

api_servers.py1.18 kB
import uvicorn import asyncio from fastapi import FastAPI from agents import init_math_agent, init_research_agent, init_meteo_agent app = FastAPI() @app.on_event("startup") async def startup(): app.state.math = await init_math_agent() app.state.research = await init_research_agent() app.state.meteo = await init_meteo_agent() @app.post("/math") async def math(query: str, prompt: str = None): resp = await app.state.math.ainvoke({"messages":[{"role":"user","content":query if not prompt else prompt+ "\n" + query}]}) return {"result": resp["messages"][-1].content} @app.post("/research") async def research(query: str, prompt: str = None): resp = await app.state.research.ainvoke({"messages":[{"role":"user","content":query if not prompt else prompt+ "\n" + query}]}) return {"result": resp["messages"][-1].content} @app.post("/meteo") async def meteo(query: str, prompt: str = None): resp = await app.state.meteo.ainvoke({"messages":[{"role":"user","content":query if not prompt else prompt+ "\n" + query}]}) return {"result": resp["messages"][-1].content} if __name__ == "__main__": uvicorn.run(app, host="127.0.0.1", port=8000)

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/kingrishabdugar/MCP_Demo'

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