@@ -190,7 +190,7 @@ def _default_run_state_validation_error(
190190# 3. to_json() always emits CURRENT_SCHEMA_VERSION.
191191# 4. Forward compatibility is intentionally fail-fast (older SDKs reject newer or unsupported
192192# versions).
193- CURRENT_SCHEMA_VERSION = "1.17 "
193+ CURRENT_SCHEMA_VERSION = "1.18 "
194194_PROGRAMMATIC_TOOL_CALLING_MIN_SCHEMA_VERSION = "1.13"
195195_HOSTED_MCP_APPROVALS_MIN_SCHEMA_VERSION = "1.14"
196196_CURRENT_RESPONSE_OWNERSHIP_MIN_SCHEMA_VERSION = "1.17"
@@ -229,6 +229,7 @@ def _default_run_state_validation_error(
229229 "Persists Docker container labels and current-response generated-item ownership across "
230230 "resume flows, including pending resumed Session writes and terminal-unrecoverable runs."
231231 ),
232+ "1.18" : "Binds restored local MCP calls to their configured server and original tool name." ,
232233}
233234SUPPORTED_SCHEMA_VERSIONS = frozenset (SCHEMA_VERSION_SUMMARIES )
234235
@@ -1984,6 +1985,10 @@ def _serialize_processed_response(
19841985 "tools_used" : processed_response .tools_used ,
19851986 ** action_groups ,
19861987 "interruptions" : interruptions_data ,
1988+ "mcp_tool_bindings" : {
1989+ call_id : list (binding )
1990+ for call_id , binding in processed_response .mcp_tool_bindings .items ()
1991+ },
19871992 }
19881993
19891994 def _serialize_current_step (self ) -> dict [str , Any ] | None :
@@ -2209,6 +2214,13 @@ async def from_string(
22092214 server and apply authorized approval decisions to that server-owned state instead.
22102215 Neither `context_override` nor `strict_context` verifies snapshot integrity.
22112216
2217+ Executing pending local MCP calls requires recipient bindings written by schema 1.18
2218+ or later.
2219+ Keep the application's MCP server configuration and ordering unchanged when resuming.
2220+ Bindings detect changes in tool-list routing, not transport settings or credentials.
2221+ Start a new run to replace a pending MCP call with a local function or handoff.
2222+ Start a new run to execute an MCP call if an older snapshot lacks these bindings.
2223+
22122224 Args:
22132225 initial_agent: The initial agent (used to build agent map for resolution).
22142226 state_string: The JSON string to deserialize.
@@ -2290,6 +2302,13 @@ async def from_json(
22902302 server and apply authorized approval decisions to that server-owned state instead.
22912303 Neither `context_override` nor `strict_context` verifies snapshot integrity.
22922304
2305+ Executing pending local MCP calls requires recipient bindings written by schema 1.18
2306+ or later.
2307+ Keep the application's MCP server configuration and ordering unchanged when resuming.
2308+ Bindings detect changes in tool-list routing, not transport settings or credentials.
2309+ Start a new run to replace a pending MCP call with a local function or handoff.
2310+ Start a new run to execute an MCP call if an older snapshot lacks these bindings.
2311+
22932312 Args:
22942313 initial_agent: The initial agent (used to build agent map for resolution).
22952314 state_json: The JSON dictionary to deserialize.
@@ -3421,6 +3440,13 @@ def _deserialize_function_actions() -> list[_DeserializedFunctionAction]:
34213440 if approval_item is not None :
34223441 interruptions .append (approval_item )
34233442
3443+ saved_bindings = processed_response_data .get ("mcp_tool_bindings" , {})
3444+ mcp_tool_bindings = {
3445+ call_id : cast (tuple [str , str , int | None ], tuple (binding ))
3446+ for call_id , binding in saved_bindings .items ()
3447+ if isinstance (binding , list )
3448+ }
3449+
34243450 return ProcessedResponse (
34253451 new_items = new_items ,
34263452 handoffs = handoffs ,
@@ -3433,6 +3459,7 @@ def _deserialize_function_actions() -> list[_DeserializedFunctionAction]:
34333459 tools_used = processed_response_data .get ("tools_used" , []),
34343460 mcp_approval_requests = mcp_approval_requests ,
34353461 interruptions = interruptions ,
3462+ mcp_tool_bindings = mcp_tool_bindings ,
34363463 )
34373464
34383465
0 commit comments