Implementation:Openai Openai python Response Function Tool Call
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Responses_API |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete type for representing a function tool call issued by the model during a Responses API interaction, provided by the openai-python SDK.
Description
ResponseFunctionToolCall is a Pydantic model that represents a tool call to run a function. It contains the arguments serialized as a JSON string, the call_id uniquely identifying the call on the model side, the name of the function to invoke, and an optional status indicating the progress of the call. The type field is always set to the literal value "function_call". See the function calling guide for more information.
Usage
Import this type when you need to inspect or type-check function tool call items returned in a Responses API response output, or when building typed event handlers for streaming responses.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/responses/response_function_tool_call.py
Signature
class ResponseFunctionToolCall(BaseModel):
"""A tool call to run a function."""
arguments: str
call_id: str
name: str
type: Literal["function_call"]
id: Optional[str] = None
status: Optional[Literal["in_progress", "completed", "incomplete"]] = None
Import
from openai.types.responses import ResponseFunctionToolCall
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| arguments | str | Yes | A JSON string of the arguments to pass to the function. |
| call_id | str | Yes | The unique ID of the function tool call generated by the model. |
| name | str | Yes | The name of the function to run. |
| type | Literal["function_call"] | Yes | The type of the function tool call. Always function_call.
|
| id | Optional[str] | No | The unique ID of the function tool call. |
| status | Optional[Literal["in_progress", "completed", "incomplete"]] | No | The status of the item. Populated when items are returned via API. |
Usage Examples
import openai
client = openai.OpenAI()
response = client.responses.create(
model="gpt-4o",
input="What is the weather in Boston?",
tools=[{
"type": "function",
"name": "get_weather",
"description": "Get the current weather for a location.",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"],
},
}],
)
for item in response.output:
if item.type == "function_call":
print(item.name) # "get_weather"
print(item.arguments) # '{"location": "Boston"}'
print(item.call_id)