mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 04:54:17 +02:00
Add version badge to on_initialize docs (#2029)
This commit is contained in:
parent
b1458c6082
commit
9cb47e12dd
1 changed files with 4 additions and 2 deletions
|
|
@ -89,11 +89,12 @@ Note that the MCP SDK may perform additional operations like listing tools for c
|
|||
This hierarchy allows you to target your middleware logic with the right level of specificity. Use `on_message` for broad concerns like logging, `on_request` for authentication, and `on_call_tool` for tool-specific logic like performance monitoring.
|
||||
|
||||
### Available Hooks
|
||||
<VersionBadge version="2.9.0" />
|
||||
|
||||
- `on_message`: Called for all MCP messages (requests and notifications)
|
||||
- `on_request`: Called specifically for MCP requests (that expect responses)
|
||||
- `on_notification`: Called specifically for MCP notifications (fire-and-forget)
|
||||
- `on_initialize`: Called when a client connects and initializes the session (returns `None`)
|
||||
|
||||
- `on_call_tool`: Called when tools are being executed
|
||||
- `on_read_resource`: Called when resources are being read
|
||||
- `on_get_prompt`: Called when prompts are being retrieved
|
||||
|
|
@ -101,7 +102,8 @@ This hierarchy allows you to target your middleware logic with the right level o
|
|||
- `on_list_resources`: Called when listing available resources
|
||||
- `on_list_resource_templates`: Called when listing resource templates
|
||||
- `on_list_prompts`: Called when listing available prompts
|
||||
|
||||
<VersionBadge version="2.13.0" />
|
||||
- `on_initialize`: Called when a client connects and initializes the session (returns `None`)
|
||||
<Note>
|
||||
The `on_initialize` hook receives the client's initialization request but **returns `None`** rather than a result. The initialization response is handled internally by the MCP protocol and cannot be modified by middleware. This hook is useful for client detection, logging connections, or initializing session state, but not for modifying the initialization handshake itself.
|
||||
</Note>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue