🚀 The fast, Pythonic way to build MCP servers and clients.
minor docs updates
Jeremiah Lowin3f793d541cdb
diff --git a/docs/servers/context.mdx b/docs/servers/context.mdxindex e6ce5a56f..685b833b0 100644--- a/docs/servers/context.mdx+++ b/docs/servers/context.mdx@@ -19,7 +19,7 @@ The `Context` object provides a clean interface to access MCP features within yo- **Request Information**: Access metadata about the current request- **Server Access**: When needed, access the underlying FastMCP server instance-## Accessing Context+## Accessing the ContextTo use the context object within your tool function, simply add a parameter to your function signature and type-hint it as `Context`. FastMCP will automatically inject the context instance when your tool is called.diff --git a/docs/servers/prompts.mdx b/docs/servers/prompts.mdxindex b9a6b520c..5668846f4 100644--- a/docs/servers/prompts.mdx+++ b/docs/servers/prompts.mdx@@ -20,7 +20,7 @@ Prompts provide parameterized message templates for LLMs. When a client requestsThis allows you to define consistent, reusable templates that LLMs can use across different clients and contexts.-## Defining Prompts+## Prompts### The `@prompt` Decoratordiff --git a/docs/servers/resources.mdx b/docs/servers/resources.mdxindex 447e854f5..6b1fe6bd2 100644--- a/docs/servers/resources.mdx+++ b/docs/servers/resources.mdx@@ -1,6 +1,6 @@---title: Resources & Templates-sidebarTitle: Resources & Templates+sidebarTitle: Resourcesdescription: Expose data sources and dynamic content generators to your MCP client.icon: database---@@ -21,7 +21,7 @@ Resources provide read-only access to data for the LLM or client application. WhThis allows LLMs to access files, database content, configuration, or dynamically generated information relevant to the conversation.-## Defining Resources+## Resources### The `@resource` Decorator@@ -201,7 +201,7 @@ mcp.add_resource(special_resource, key="internal://data-v2") # Will be stored aNote that this parameter is only available when using `add_resource()` directly and not through the `@resource` decorator, as URIs are provided explicitly when using the decorator.-## Defining Resource Templates+## Resource TemplatesResource Templates allow clients to request resources whose content depends on parameters embedded in the URI. Define a template using the **same `@mcp.resource` decorator**, but include `{parameter_name}` placeholders in the URI string and add corresponding arguments to your function signature.diff --git a/docs/servers/tools.mdx b/docs/servers/tools.mdxindex 7d4fdbf50..6eded291f 100644--- a/docs/servers/tools.mdx+++ b/docs/servers/tools.mdx@@ -18,7 +18,7 @@ Tools in FastMCP transform regular Python functions into capabilities that LLMsThis allows LLMs to perform tasks like querying databases, calling APIs, making calculations, or accessing files—extending their capabilities beyond what's in their training data.-## Defining Tools+## Tools### The `@tool` Decoratordiff --git a/tests/server/test_server_interactions.py b/tests/server/test_server_interactions.pyindex 6ac501787..a02afd533 100644--- a/tests/server/test_server_interactions.py+++ b/tests/server/test_server_interactions.py@@ -180,6 +180,21 @@ class TestTools:assert "title" in propertiesassert properties["title"]["description"] == "Optional title"+ async def test_tool_with_bytes_input(self):+ mcp = FastMCP()++ @mcp.tool()+ def process_image(image: bytes) -> Image:+ return Image(data=image)++ async with Client(mcp) as client:+ result = await client.call_tool(+ "process_image", {"image": b"fake png data"}+ )+ assert isinstance(result[0], ImageContent)+ assert result[0].mimeType == "image/png"+ assert result[0].data == base64.b64encode(b"fake png data").decode()+class TestResources:async def test_text_resource(self):