Rebuild the docs around tested examples; shrink README.v2.md to a pitch (#2978)
This commit is contained in:
parent
4caa41f6d5
commit
411a6d3980
1 changed files with 9510 additions and 2639 deletions
24
docs_src/media/tutorial002.py
Normal file
24
docs_src/media/tutorial002.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import base64
|
||||
|
||||
from mcp.server import MCPServer
|
||||
from mcp.server.mcpserver import Audio, Image
|
||||
|
||||
mcp = MCPServer("Brand kit")
|
||||
|
||||
LOGO_PNG = base64.b64decode(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGOQ9bsBAAHPAURf8l/aAAAAAElFTkSuQmCC"
|
||||
)
|
||||
|
||||
CHIME_WAV = base64.b64decode("UklGRjQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YRAAAAAAAAAAAAAAAAAAAAAAAAAA")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def logo() -> Image:
|
||||
"""The brand logo as a PNG."""
|
||||
return Image(data=LOGO_PNG, format="png")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def chime() -> Audio:
|
||||
"""The notification chime as a WAV."""
|
||||
return Audio(data=CHIME_WAV, format="wav")
|
||||
Loading…
Reference in a new issue