Function: mcpTool()
@providerprotocol/ai / openai / mcpTool
Function: mcpTool()
Section titled “Function: mcpTool()”mcpTool(
options):OpenAIMcpTool
Defined in: src/providers/openai/types.ts:1511
Creates an MCP (Model Context Protocol) tool configuration for the Responses API.
The MCP tool enables connections to external MCP servers, allowing the model to use tools and resources provided by those servers.
Parameters
Section titled “Parameters”options
Section titled “options”MCP server configuration
allowed_tools?
Section titled “allowed_tools?”string[] | { type: "all"; }
headers?
Section titled “headers?”Record<string, string>
string
require_approval?
Section titled “require_approval?”"always" | "never" | { tools: string[]; type: "except"; }
string
Returns
Section titled “Returns”An MCP tool configuration object
Example
Section titled “Example”const mcp = mcpTool({ url: 'https://mcp-server.example.com', name: 'my-mcp-server', allowed_tools: ['tool1', 'tool2']});