We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0131b0f + ac43b98 commit a07bb8eCopy full SHA for a07bb8e
units/en/unit1/sdk.mdx
@@ -27,19 +27,19 @@ from mcp.server.fastmcp import FastMCP
27
# Create an MCP server
28
mcp = FastMCP("Weather Service")
29
30
-
+# Tool implementation
31
@mcp.tool()
32
def get_weather(location: str) -> str:
33
"""Get the current weather for a specified location."""
34
return f"Weather in {location}: Sunny, 72°F"
35
36
+# Resource implementation
37
@mcp.resource("weather://{location}")
38
def weather_resource(location: str) -> str:
39
"""Provide weather data as a resource."""
40
return f"Weather data for {location}: Sunny, 72°F"
41
42
+# Prompt implementation
43
@mcp.prompt()
44
def weather_report(location: str) -> str:
45
"""Create a weather report prompt."""
0 commit comments