docs: add snippet verification for docs/ pages (#2115)

This commit is contained in:
Felix Weinberger 2026-02-23 15:38:15 +00:00 • committed by GitHub
commit 1ef124e4a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,19 @@
from mcp.server.fastmcp import FastMCP
from mcp.types import EmbeddedResource, TextResourceContents
mcp = FastMCP("Embedded Resource Example")
@mcp.tool()
def read_config(path: str) -> EmbeddedResource:
"""Read a config file and return it as an embedded resource."""
with open(path) as f:
content = f.read()
return EmbeddedResource(
type="resource",
resource=TextResourceContents(
uri=f"file://{path}",
text=content,
mimeType="application/json",
),
)