> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meshagent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Tool Response Adapter

`OpenAIResponsesToolResponseAdapter` is the default `ToolResponseAdapter` used whenever you pair an agent with the OpenAI Responses adapter. It converts tool outputs into the payloads the OpenAI Responses API expects and exposes a plain-text summary that hosts can display or log.

## Behavior summary

* **Plain-text rendering:** `to_plain_text` generates concise strings for common response types (`LinkChunk`, `JsonChunk`, `TextChunk`, `FileChunk`, `EmptyChunk`). Hosts decide whether to show or log that text.
* **Chat context updates:** `create_messages` returns OpenAI Responses `function_call_output` objects so the model receives the tool result on the next turn.
* **Developer logging:** Emits events via `room.developer.log_nowait` to aid debugging when tools are called.

## Response handling

| Response type | Plain text example | Notes |
| - | - | - |
| `TextChunk` | The returned text | Injected as-is into the chat transcript. |
| `JsonChunk` | JSON string dump | Useful when the LLM expects structured output. |
| `FileChunk` | `filename.ext` | Images become `input_image` payloads; PDFs use `input_file`; text/JSON are inlined; other formats return a "not supported" message. |
| `LinkChunk` | `{ "name": ..., "url": ... }` | Links become JSON strings so the user can follow the URL. |
| `EmptyChunk` | `"ok"` | Signals successful execution without additional data. |
| `RawOutputsChunk` | n/a | Passed through directly as OpenAI Responses outputs, bypassing plain-text conversion. |

## Extending or replacing

You can subclass `OpenAIResponsesToolResponseAdapter` to tweak the plain-text summary or adjust logging, provided the emitted messages continue to match the OpenAI Responses schema. Alternatively, supply your own adapter instance when constructing the agent.

## Where it is used

* Automatically when you construct `OpenAIResponsesAdapter` without specifying a custom `tool_adapter`.
* In the CLI chatbot and MeshAgent Studio when interacting with OpenAI models.
* Any agent that wants to reuse the same formatting logic can import and instantiate it directly.

## Related references

* [Adapters Overview](./index): Understand LLMAdapters and ToolResponseAdapters
* [OpenAI Responses Adapter](./openai_responses_adapter): Understand the LLM integration that uses this adapter.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.