mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Fix broken code examples in docs (#3869)
* Fix broken code examples in docs - Tag error output blocks as ```text instead of ```python (anthropic, openai integration docs + v2 mirrors) - Quote unquoted URL in Descope config example (+ v2 mirror) - Fix GoogleGenAISamplingHandler → GoogleGenaiSamplingHandler casing in sampling docs - Fix import path: handlers.GoogleGenaiSamplingHandler → handlers.google_genai.GoogleGenaiSamplingHandler in v3-features 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix remaining broken doc examples and add skip tags for false positives - BearerTokenAuth → StaticTokenVerifier in deployment/http.mdx - providers.oauth → server.auth import in authentication.mdx - ListToolsNext → updated list_tools API in v3-features.mdx - OAuthClientProvider → OAuth in v2/storage-backends.mdx - Add test="skip" for upgrade guides, contrib placeholders, f-string backticks 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Ratchet doc example baselines to zero All 1444 examples now pass syntax and import checks. 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add pytest-examples dev dep, fix client_id in StaticTokenVerifier example, commit missed openapi fixes - Add pytest-examples to dev dependencies (fixes CI ModuleNotFoundError) - Include required client_id in StaticTokenVerifier token payload - Commit previously unstaged HTTPRoute import fixes in openapi.mdx 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update deprecated import paths across docs - fastmcp.server.openapi → fastmcp.server.providers.openapi - fastmcp.server.proxy → fastmcp.server.providers.proxy - fastmcp.server.apps → fastmcp.apps - Tag upgrade guide "Before" examples with test="skip" 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d6b55c0b2f
commit
901453902f
30 changed files with 337 additions and 72 deletions
|
|
@ -29,7 +29,7 @@ FastMCP now includes a sampling handler for Google's Gemini models ([#2977](http
|
|||
|
||||
```python
|
||||
from fastmcp import Client
|
||||
from fastmcp.client.sampling.handlers import GoogleGenaiSamplingHandler
|
||||
from fastmcp.client.sampling.handlers.google_genai import GoogleGenaiSamplingHandler
|
||||
from google.genai import Client as GoogleGenaiClient
|
||||
|
||||
# Initialize the handler
|
||||
|
|
@ -386,7 +386,7 @@ Support for [MCP Apps](https://modelcontextprotocol.io/specification/2025-06-18/
|
|||
|
||||
```python
|
||||
from fastmcp import FastMCP
|
||||
from fastmcp.server.apps import AppConfig, ResourceCSP, ResourcePermissions
|
||||
from fastmcp.apps import AppConfig, ResourceCSP, ResourcePermissions
|
||||
|
||||
mcp = FastMCP("My Server")
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ The `app=` parameter accepts `True` (enable with defaults), an `AppConfig` insta
|
|||
|
||||
```python
|
||||
from fastmcp import Context
|
||||
from fastmcp.server.apps import AppConfig, UI_EXTENSION_ID
|
||||
from fastmcp.apps import AppConfig, UI_EXTENSION_ID
|
||||
|
||||
@mcp.tool(app=AppConfig(resource_uri="ui://dashboard"))
|
||||
async def dashboard(ctx: Context) -> dict:
|
||||
|
|
@ -575,15 +575,14 @@ provider.add_transform(ToolTransform({
|
|||
|
||||
```python
|
||||
from collections.abc import Sequence
|
||||
from fastmcp.server.transforms import Transform, ListToolsNext, GetToolNext
|
||||
from fastmcp.server.transforms import Transform, GetToolNext
|
||||
from fastmcp.tools import Tool
|
||||
|
||||
class TagFilter(Transform):
|
||||
def __init__(self, required_tags: set[str]):
|
||||
self.required_tags = required_tags
|
||||
|
||||
async def list_tools(self, call_next: ListToolsNext) -> Sequence[Tool]:
|
||||
tools = await call_next() # Get tools from downstream
|
||||
async def list_tools(self, tools: Sequence[Tool]) -> Sequence[Tool]:
|
||||
return [t for t in tools if t.tags & self.required_tags]
|
||||
|
||||
async def get_tool(self, name: str, call_next: GetToolNext) -> Tool | None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue