Spaces:
Sleeping
Sleeping
from fastmcp import FastMCP | |
import numpy as np | |
mcp = FastMCP("Demo π") | |
def hello(name: str) -> str: | |
return f"Hello, {name}!" | |
def multiply(a: float, b: float) -> float: | |
"""Multiplies two numbers.""" | |
return a * b | |
def inner_product(a: list[float], b: list[float]) -> float: | |
"""Calculates the inner product of two vectors.""" | |
return np.dot(a, b) | |
def matrix_multiply(a: list[list[float]], b: list[list[float]]) -> list[list[float]]: | |
"""Multiplies two matrices.""" | |
return np.matmul(a, b) | |
# Static resource | |
def get_version(): | |
return "2.0.1" | |
# Dynamic resource template | |
def get_profile(user_id: int): | |
# Fetch profile for user_id... | |
return {"name": f"User {user_id}", "status": "active"} | |
def summarize_request(text: str) -> str: | |
"""Generate a prompt asking for a summary.""" | |
return f"Please summarize the following text:\n\n{text}" | |
if __name__ == "__main__": | |
mcp.run(transport="sse", host="0.0.0.0", port=7860) |