openai.ResponsesTool
A synchronous Responses tool that preserves Console text and images.
Usage
openai.ResponsesTool(console, tool)Create these through responses_tools() 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:
tools = mcp_console.openai.responses_tools(console)
by_name = {tool.definition["name"]: tool for tool in tools}
output = by_name["send"].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 this tool’s arguments supplied as a JSON string or mapping. |
| output() |
Execute a model function call and return its function_call_output.
|
call()
Execute this tool’s 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).