mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 15:19:10 +02:00
30 lines
476 B
Python
30 lines
476 B
Python
"""
|
|
FastMCP Echo Server
|
|
"""
|
|
|
|
from fastmcp import FastMCP
|
|
|
|
# Create server
|
|
mcp = FastMCP("Echo Server")
|
|
|
|
|
|
@mcp.tool()
|
|
def echo_tool(text: str) -> str:
|
|
"""Echo the input text"""
|
|
return text
|
|
|
|
|
|
@mcp.resource("echo://static")
|
|
def echo_resource() -> str:
|
|
return "Echo!"
|
|
|
|
|
|
@mcp.resource("echo://{text}")
|
|
def echo_template(text: str) -> str:
|
|
"""Echo the input text"""
|
|
return f"Echo: {text}"
|
|
|
|
|
|
@mcp.prompt("echo")
|
|
def echo_prompt(text: str) -> str:
|
|
return text
|