Skip to content

Function: mcpTool()

@providerprotocol/ai


@providerprotocol/ai / openai / 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.

MCP server configuration

string[] | { type: "all"; }

Record<string, string>

string

"always" | "never" | { tools: string[]; type: "except"; }

string

OpenAIMcpTool

An MCP tool configuration object

const mcp = mcpTool({
url: 'https://mcp-server.example.com',
name: 'my-mcp-server',
allowed_tools: ['tool1', 'tool2']
});