mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 13:04:18 +02:00
* Add meta to ToolResult * add this at the client level and test the full integration * add example * slipped through linting somehow --------- Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
22 lines
371 B
Python
22 lines
371 B
Python
"""
|
|
FastMCP Echo Server
|
|
"""
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from fastmcp import FastMCP
|
|
from fastmcp.tools.tool import ToolResult
|
|
|
|
mcp = FastMCP("Echo Server")
|
|
|
|
|
|
@dataclass
|
|
class EchoData:
|
|
data: str
|
|
|
|
|
|
@mcp.tool
|
|
def echo(text: str) -> ToolResult:
|
|
return ToolResult(
|
|
content=text, structured_content=EchoData(data=text), meta={"some": "metadata"}
|
|
)
|