To Openai Tool • AI Agent SDK
to_openai_tool: Convert the MCP tool to an OpenAI-compatible tool definition.
to_openai_tool
Method
</div>
Convert the MCP tool to an OpenAI-compatible tool definition.
This method is specifically invoked by the Agent class when using provider/model format (e.g., “openai/gpt-4o-mini”).
Signature
def to_openai_tool() -> AnyReturns
ResponseField
AnyOpenAI-compatible tool definition(s)
Uses
to_openai_toolslogging.warning
Source
View on GitHubpraisonaiagents/mcp/mcp.py at line 1383