in content_api.py [0:0]
def tool_cancellation(self) -> str | None:
"""Returns an id of a function call to be cancelled.
If the part is not a tool cancellation request, returns None.
Returns:
The id of the function call to be cancelled or None if this part is not a
tool cancellation from the model.
"""
if not self.part.function_response:
return None
if self.part.function_response.name != 'tool_cancellation':
return None
if not self.part.function_response.response:
return None
return self.part.function_response.response.get('function_call_id', None)