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
[read, state] tuple. Call read(uri) on demand.
Auto-Fetch Mode
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 astate:// URI with live updates via MCP resource subscriptions.
notifications/resources/updated, the hook automatically re-fetches the resource. Content is JSON-parsed when possible.
Example
useServer
Low-level hook to access a rawServerEntry from the registry.
useSyncExternalStore for tear-free reads.
useResolvedServer
Internal hook that resolves a server entry with context fallback.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).With Zod Schema (Recommended)
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: