Implementation:Openai Openai python Response MCP Call Args Done
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Responses_API |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete streaming event type for signaling that MCP tool call arguments have been finalized provided by the openai-python SDK.
Description
ResponseMcpCallArgumentsDoneEvent is a Pydantic model emitted when the arguments for an MCP tool call are finalized. It carries an arguments field containing the complete JSON string of finalized arguments, the item_id identifying the MCP tool call item, the output_index locating it in the response output array, and a sequence_number for event ordering. The type field is always "response.mcp_call_arguments.done".
Usage
Import this type when building streaming event handlers that need to detect when MCP tool call argument construction is complete, enabling you to parse the full arguments JSON and proceed with tool execution.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/responses/response_mcp_call_arguments_done_event.py
Signature
class ResponseMcpCallArgumentsDoneEvent(BaseModel):
"""Emitted when the arguments for an MCP tool call are finalized."""
arguments: str
item_id: str
output_index: int
sequence_number: int
type: Literal["response.mcp_call_arguments.done"]
Import
from openai.types.responses import ResponseMcpCallArgumentsDoneEvent
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| arguments | str | Yes | A JSON string containing the finalized arguments for the MCP tool call. |
| item_id | str | Yes | The unique identifier of the MCP tool call item being processed. |
| output_index | int | Yes | The index of the output item in the response's output array. |
| sequence_number | int | Yes | The sequence number of this event. |
| type | Literal["response.mcp_call_arguments.done"] | Yes | The type of the event. Always response.mcp_call_arguments.done.
|
Usage Examples
import json
import openai
client = openai.OpenAI()
stream = client.responses.create(
model="gpt-4o",
input="Use the MCP tool to fetch data.",
stream=True,
)
for event in stream:
if event.type == "response.mcp_call_arguments.done":
args = json.loads(event.arguments)
print(f"Final arguments for item {event.item_id}: {args}")