Implementation:Openai Openai python Response MCP Call Completed
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Responses_API |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete streaming event type for signaling that an MCP tool call has completed successfully provided by the openai-python SDK.
Description
ResponseMcpCallCompletedEvent is a Pydantic model emitted when an MCP tool call has completed successfully. It carries the item_id identifying the MCP tool call item that completed, the output_index indicating which output item completed, and a sequence_number for event ordering. The type field is always "response.mcp_call.completed".
Usage
Import this type when building streaming event handlers that need to detect successful completion of MCP tool calls, for example to trigger downstream processing of the tool call result.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/responses/response_mcp_call_completed_event.py
Signature
class ResponseMcpCallCompletedEvent(BaseModel):
"""Emitted when an MCP tool call has completed successfully."""
item_id: str
output_index: int
sequence_number: int
type: Literal["response.mcp_call.completed"]
Import
from openai.types.responses import ResponseMcpCallCompletedEvent
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| item_id | str | Yes | The ID of the MCP tool call item that completed. |
| output_index | int | Yes | The index of the output item that completed. |
| sequence_number | int | Yes | The sequence number of this event. |
| type | Literal["response.mcp_call.completed"] | Yes | The type of the event. Always response.mcp_call.completed.
|
Usage Examples
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.completed":
print(f"MCP call completed: item {event.item_id} "
f"at output index {event.output_index}")