Skip to main content
Most data hooks support multi-server targeting via an options.server parameter. When omitted, they use the provider’s default server. Low-level hooks like useServer and useResolvedServer accept a server name directly as an argument instead.

useCallTool

Call an MCP tool with typed input/output.

Parameters

Return Value

Example


useReadResource

Dual-mode resource reading — lazy or auto-fetch.

Lazy Mode

Returns a [read, state] tuple. Call read(uri) on demand.

Auto-Fetch Mode

Fetches automatically when connected. Call refetch() to re-read.

useGetPrompt

Fetch an MCP prompt by name.

Example


useListTools

Reactive tool list from the registry.

useListResources

Reactive resource and resource template lists.

useListPrompts

Reactive prompt list.

useStoreResource

Subscribe to a state:// URI with live updates via MCP resource subscriptions.
When the server sends notifications/resources/updated, the hook automatically re-fetches the resource. Content is JSON-parsed when possible.

Example


useServer

Low-level hook to access a raw ServerEntry from the registry.
Uses useSyncExternalStore for tear-free reads.

useResolvedServer

Internal hook that resolves a server entry with context fallback.
This is the shared foundation for all other hooks. You typically don’t need to use it directly.

useDynamicTool

Register an MCP tool on mount, unregister on unmount. See Dynamic Tools for full details. Supports both zod schemas (recommended) and raw JSON Schema (backward compat).
When using a zod schema, input is automatically validated via safeParse before reaching your execute callback. Invalid input returns an error CallToolResult with validation details.

With JSON Schema (Backward Compat)

Options


useDynamicResource

Register an MCP resource on mount, unregister on unmount. See Dynamic Tools for full details.

Options


useComponentTree

Expose the DOM subtree under a ref as a JSON MCP resource. See Dynamic Tools for full details.

Options


Multi-Server Pattern

All hooks accept { server: 'name' } to target a specific server: