Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Use transforms= kwarg in docs examples

Jeremiah Lowin14e64b3b22db
diff --git a/docs/servers/transforms/code-mode.mdx b/docs/servers/transforms/code-mode.mdx
index 755e94991..2a6db4921 100644
--- a/docs/servers/transforms/code-mode.mdx
+++ b/docs/servers/transforms/code-mode.mdx
@@ -66,9 +66,10 @@ Search uses BM25 ranking by default, matching against tool names and description
```python
from fastmcp.server.transforms.search import RegexSearchTransform
-mcp = FastMCP("Server", transforms=[
- CodeMode(search_transform=RegexSearchTransform())
-])
+mcp = FastMCP(
+ "Server",
+ transforms=[CodeMode(search_transform=RegexSearchTransform())],
+)
```
## Execute
diff --git a/docs/servers/transforms/tool-search.mdx b/docs/servers/transforms/tool-search.mdx
index 5db4149f1..204004f5c 100644
--- a/docs/servers/transforms/tool-search.mdx
+++ b/docs/servers/transforms/tool-search.mdx
@@ -37,7 +37,7 @@ FastMCP provides two search transforms. They share the same interface β€” two sy
from fastmcp import FastMCP
from fastmcp.server.transforms.search import RegexSearchTransform
-mcp = FastMCP("My Server")
+mcp = FastMCP("My Server", transforms=[RegexSearchTransform()])
@mcp.tool
def search_database(query: str, limit: int = 10) -> list[dict]:
@@ -53,8 +53,6 @@ def delete_record(record_id: str) -> bool:
def send_email(to: str, subject: str, body: str) -> bool:
"""Send an email to the given recipient."""
...
-
-mcp.add_transform(RegexSearchTransform())
```
The LLM's `search_tools` call takes a `pattern` parameter β€” a regex string:
@@ -79,11 +77,9 @@ Results are returned in catalog order. If the pattern is invalid regex, the sear
from fastmcp import FastMCP
from fastmcp.server.transforms.search import BM25SearchTransform
-mcp = FastMCP("My Server")
+mcp = FastMCP("My Server", transforms=[BM25SearchTransform()])
# ... define tools ...
-
-mcp.add_transform(BM25SearchTransform())
```
The LLM's `search_tools` call takes a `query` parameter β€” natural language: