@frontmcp/react/ai entry point bridges FrontMCP tools to popular AI SDK formats. Tools are automatically formatted for the target platform and results are converted back.
useAITools
The core hook that formats MCP tools for a specific platform.Parameters
| Parameter | Type | Description |
|---|---|---|
platform | SupportedPlatform | 'openai' | 'claude' | 'vercel-ai' |
options.server | string | Target a named server |
Return Value
| Field | Type | Description |
|---|---|---|
tools | PlatformToolsMap[P] | null | Tools formatted for the target platform |
callTool | (name, args) => Promise<FormattedToolResult> | Execute a tool and format the result |
loading | boolean | True while formatting tools |
error | Error | null | Formatting or execution error |
useTools
Higher-level hook that adds batch tool call processing viaprocessPlatformToolCalls.
Return Value
| Field | Type | Description |
|---|---|---|
tools | PlatformToolsMap[P] | null | Formatted tools |
processToolCalls | (calls) => Promise<PlatformToolCallsOutput[P]> | Batch process tool calls |
loading | boolean | Loading state |
error | Error | null | Error state |