mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 15:19:10 +02:00
Update readmeUpdate README
This commit is contained in:
parent
ba94bf6bbb
commit
aed403d929
5 changed files with 310 additions and 122 deletions
19
examples/readme-quickstart.py
Normal file
19
examples/readme-quickstart.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from fastmcp import FastMCP
|
||||
|
||||
|
||||
# Create an MCP server
|
||||
mcp = FastMCP("Demo")
|
||||
|
||||
|
||||
# Add an addition tool
|
||||
@mcp.tool()
|
||||
def add(a: int, b: int) -> int:
|
||||
"""Add two numbers"""
|
||||
return a + b
|
||||
|
||||
|
||||
# Add a dynamic greeting resource
|
||||
@mcp.resource("greeting://{name}")
|
||||
def get_greeting(name: str) -> str:
|
||||
"""Get a personalized greeting"""
|
||||
return f"Hello, {name}!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue