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,26 @@
import mcp.types as types
from mcp.server.fastmcp import FastMCP
from mcp.server.fastmcp.prompts import base
mcp = FastMCP("Embedded Resource Prompt Example")
@mcp.prompt()
def review_file(filename: str) -> list[base.Message]:
"""Review a file with its contents embedded."""
file_content = open(filename).read()
return [
base.UserMessage(
content=types.TextContent(type="text", text=f"Please review {filename}:"),
),
base.UserMessage(
content=types.EmbeddedResource(
type="resource",
resource=types.TextResourceContents(
uri=f"file://{filename}",
text=file_content,
mimeType="text/plain",
),
),
),
]