openai.ResponsesTool
A synchronous Responses tool that preserves Console text and images.
Usage
openai.ResponsesTool(console, tool)Create this through responses_tool() with an MCPConsole. The factory page shows how to register definition and return tool(call) results in a complete model loop.
Examples
Install with pip install 'mcp-console[openai]'. You can also invoke call() directly to inspect the output without a model or API key:
import mcp_console
from mcp_console import MCPConsole
with MCPConsole() as console:
tool = mcp_console.openai.responses_tool(console)
output = tool.call({"python": "sum([12, 15, 18, 20, 25])"})
print(output)Attributes
| Name | Description |
|---|---|
| definition |
Function-tool definition to place in responses.create(tools=...).
|
definition
Function-tool definition to place in responses.create(tools=...).
definition: dict[str, Any]
Methods
| Name | Description |
|---|---|
| call() |
Execute send arguments supplied as a JSON string or mapping.
|
| output() |
Execute a model function call and return its function_call_output.
|
call()
Execute send arguments supplied as a JSON string or mapping.
Usage
call(arguments)Returns text for text-only output, or Responses input_text and input_image blocks for rich output. A model call’s arguments can be passed directly; output() also attaches its call_id.
output()
Execute a model function call and return its function_call_output.
Usage
output(call)Accepts a Responses function-call object or a mapping with call_id and arguments. Pass the returned item in the next request’s input. tool(call) is shorthand for tool.output(call).