docs: add snippet verification for docs/ pages (#2115)
This commit is contained in:
parent
cfbbd7d71a
commit
1ef124e4a8
1 changed files with 446 additions and 43 deletions
20
examples/snippets/servers/prompt_image_content.py
Normal file
20
examples/snippets/servers/prompt_image_content.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import mcp.types as types
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from mcp.server.fastmcp.prompts import base
|
||||
from mcp.server.fastmcp.utilities.types import Image
|
||||
|
||||
mcp = FastMCP("Image Prompt Example")
|
||||
|
||||
|
||||
@mcp.prompt()
|
||||
def describe_image(image_path: str) -> list[base.Message]:
|
||||
"""Prompt that includes an image for analysis."""
|
||||
img = Image(path=image_path)
|
||||
return [
|
||||
base.UserMessage(
|
||||
content=types.TextContent(type="text", text="Describe this image:"),
|
||||
),
|
||||
base.UserMessage(
|
||||
content=img.to_image_content(),
|
||||
),
|
||||
]
|
||||
Loading…
Reference in a new issue