openai.AsyncResponsesTool
An async Responses function tool that preserves Console text and images.
Usage
openai.AsyncResponsesTool(console, tool)Create these through responses_tools() with an AsyncMCPConsole. Use definition when requesting a model response, then await tool(call) to build the next request’s function-call output. The factory page shows the 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 asyncio
import mcp_console
from mcp_console import AsyncMCPConsole
async def main():
async with AsyncMCPConsole() as console:
tools = mcp_console.openai.responses_tools(console)
by_name = {tool.definition["name"]: tool for tool in tools}
output = await by_name["send"].call(
{"python": "sum([12, 15, 18, 20, 25])"}
)
print(output)
asyncio.run(main())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. await tool(call) is shorthand for await tool.output(call).