.codecompanion/acp/codex_acp.md
This file shows the Codex ACP adapter's JSON RPC output when various tools are called.
When editing a file:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call","toolCallId":"call_oFW6vJqQoTRMTmoGoBfaPVpU","title":"Edit /Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt","kind":"edit","status":"in_progress","content":[{"type":"diff","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt","oldText":"","newText":"Hello World\n"}],"locations":[{"path":"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt"}],"rawInput":{"auto_approved":true,"call_id":"call_oFW6vJqQoTRMTmoGoBfaPVpU","changes":{"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt":{"update":{"move_path":null,"new_content":"Hello World\n","old_content":"","unified_diff":"@@ -0,0 +1 @@\n+Hello World\n"}}}}}}}
{"jsonrpc":"2.0","id":1,"method":"fs/read_text_file","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt"}}
{"result":{"content":""},"jsonrpc":"2.0","id":1}
{"jsonrpc":"2.0","id":2,"method":"fs/write_text_file","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt","content":"Hello World\n"}}
{"result":null,"jsonrpc":"2.0","id":2}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_oFW6vJqQoTRMTmoGoBfaPVpU","status":"completed","rawOutput":{"call_id":"call_oFW6vJqQoTRMTmoGoBfaPVpU","stderr":"","stdout":"Success. Updated the following files:\nM hello.txt\n","success":true}}}}
To read a file:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call","toolCallId":"call_Eh0sO2PEMSRAB9LYawtC0h9m","title":"Read hello.txt","kind":"read","status":"in_progress","locations":[{"path":"/Users/Oli/Code/Neovim/codecompanion.nvim/./hello.txt"}],"rawInput":{"call_id":"call_Eh0sO2PEMSRAB9LYawtC0h9m","command":["bash","-lc","cat hello.txt"],"cwd":"/Users/Oli/Code/Neovim/codecompanion.nvim/.","is_user_shell_command":false,"parsed_cmd":[{"cmd":"cat hello.txt","name":"hello.txt","path":"hello.txt","type":"read"}]}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_Eh0sO2PEMSRAB9LYawtC0h9m","content":[{"type":"content","content":{"type":"text","text":"```txt\nHello World\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_Eh0sO2PEMSRAB9LYawtC0h9m","status":"completed","rawOutput":{"aggregated_output":"Hello World\n","call_id":"call_Eh0sO2PEMSRAB9LYawtC0h9m","duration":{"nanos":41206625,"secs":0},"exit_code":0,"formatted_output":"Hello World\n","stderr":"","stdout":"Hello World\n"}}}}
Or:
{"jsonrpc":"2.0","id":0,"method":"fs/read_text_file","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt"}}
{"jsonrpc":"2.0","id":1,"method":"fs/read_text_file","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/hello.txt"}}
When executing a command:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553a-2c2a-7391-8c08-2770d2e70928","update":{"sessionUpdate":"tool_call","toolCallId":"call_QRACEJw4YtxHFawdNjTkuB6A","title":"List /Users/Oli/Code/Neovim/codecompanion.nvim","kind":"search","status":"in_progress","rawInput":{"call_id":"call_QRACEJw4YtxHFawdNjTkuB6A","command":["bash","-lc","ls"],"cwd":"/Users/Oli/Code/Neovim/codecompanion.nvim","is_user_shell_command":false,"parsed_cmd":[{"cmd":"ls","path":null,"type":"list_files"}]}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553a-2c2a-7391-8c08-2770d2e70928","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_QRACEJw4YtxHFawdNjTkuB6A","content":[{"type":"content","content":{"type":"text","text":"```sh\n_typos.toml\nCHANGELOG.md\nCLAUDE.md\ncodecompanion-workspace.json\nCONTRIBUTING.md\ndeps\ndoc\nexamples\nhello.txt\nLICENSE\nlua\nMakefile\nmedia\nmemories\nminimal.lua\nplugin\nqueries\nREADME.md\nscripts\nstylua.toml\nsyntax\ntests\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553a-2c2a-7391-8c08-2770d2e70928","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_QRACEJw4YtxHFawdNjTkuB6A","status":"completed","rawOutput":{"aggregated_output":"_typos.toml\nCHANGELOG.md\nCLAUDE.md\ncodecompanion-workspace.json\nCONTRIBUTING.md\ndeps\ndoc\nexamples\nhello.txt\nLICENSE\nlua\nMakefile\nmedia\nmemories\nminimal.lua\nplugin\nqueries\nREADME.md\nscripts\nstylua.toml\nsyntax\ntests\n","call_id":"call_QRACEJw4YtxHFawdNjTkuB6A","duration":{"nanos":24548166,"secs":0},"exit_code":0,"formatted_output":"_typos.toml\nCHANGELOG.md\nCLAUDE.md\ncodecompanion-workspace.json\nCONTRIBUTING.md\ndeps\ndoc\nexamples\nhello.txt\nLICENSE\nlua\nMakefile\nmedia\nmemories\nminimal.lua\nplugin\nqueries\nREADME.md\nscripts\nstylua.toml\nsyntax\ntests\n","stderr":"","stdout":"_typos.toml\nCHANGELOG.md\nCLAUDE.md\ncodecompanion-workspace.json\nCONTRIBUTING.md\ndeps\ndoc\nexamples\nhello.txt\nLICENSE\nlua\nMakefile\nmedia\nmemories\nminimal.lua\nplugin\nqueries\nREADME.md\nscripts\nstylua.toml\nsyntax\ntests\n"}}}}
When searching for content and there's no data:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553a-f4f2-7da1-820a-409c1f28ed67","update":{"sessionUpdate":"tool_call","toolCallId":"call_N7nO0Dmkpv6Q92dIlKkdJ1FC","title":"Search rg --files -0","kind":"search","status":"in_progress","rawInput":{"call_id":"call_N7nO0Dmkpv6Q92dIlKkdJ1FC","command":["bash","-lc","rg --files -0 | xargs -0 -n1 rg -n \"Sheffield United\""],"cwd":"/Users/Oli/Code/Neovim/codecompanion.nvim","is_user_shell_command":false,"parsed_cmd":[{"cmd":"rg --files -0","path":null,"query":null,"type":"search"}]}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553a-f4f2-7da1-820a-409c1f28ed67","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_N7nO0Dmkpv6Q92dIlKkdJ1FC","content":[{"type":"content","content":{"type":"text","text":"```sh\nxargs: sysconf(_SC_ARG_MAX) failed\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553a-f4f2-7da1-820a-409c1f28ed67","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_N7nO0Dmkpv6Q92dIlKkdJ1FC","status":"failed","rawOutput":{"aggregated_output":"xargs: sysconf(_SC_ARG_MAX) failed\n","call_id":"call_N7nO0Dmkpv6Q92dIlKkdJ1FC","duration":{"nanos":38576750,"secs":0},"exit_code":1,"formatted_output":"xargs: sysconf(_SC_ARG_MAX) failed\n","stderr":"xargs: sysconf(_SC_ARG_MAX) failed\n","stdout":""}}}}
When searching for content and there is data:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553d-f694-75f2-a417-d5c5e6516994","update":{"sessionUpdate":"tool_call","toolCallId":"call_JuAWfz46dfO7vvbpAtQRjKOW","title":"Search add_buf_message","kind":"search","status":"in_progress","rawInput":{"call_id":"call_JuAWfz46dfO7vvbpAtQRjKOW","command":["bash","-lc","rg --line-number \"add_buf_message\""],"cwd":"/Users/Oli/Code/Neovim/codecompanion.nvim","is_user_shell_command":false,"parsed_cmd":[{"cmd":"rg --line-number add_buf_message","path":null,"query":"add_buf_message","type":"search"}]}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553d-f694-75f2-a417-d5c5e6516994","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_JuAWfz46dfO7vvbpAtQRjKOW","content":[{"type":"content","content":{"type":"text","text":"```sh\ncodecompanion-workspace.json:106: \"description\": \"Messages in the chat buffer are lua table objects as seen in `${filename}`. They contain the role of the message (user, assistant, system), the content of the message, and any additional metadata such as visibility and sometimes type. The latter are important when data is being written to the buffer with `add_buf_message` as they allow the chat ui builder pattern to determine the type of message that it's receiving and therefore determine how to format it. In the example shared in `${filename}`, you can see how a user has prompted the LLM to use a tool and the chain of messages that lead to the LLM's final response.\"\ncodecompanion-workspace.json:136: \"description\": \"The message builder coordinates the entire process of adding content to the chat buffer. It uses a fluent interface to chain operations: adding headers when roles change, formatting content through specialized formatters, writing to the buffer with proper folding, and updating internal state. It is called from the chat buffer's `add_buf_message` method which occurs throughout the codebase.\"\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553d-f694-75f2-a417-d5c5e6516994","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_JuAWfz46dfO7vvbpAtQRjKOW","content":[{"type":"content","content":{"type":"text","text":"```sh\ncodecompanion-workspace.json:106: \"description\": \"Messages in the chat buffer are lua table objects as seen in `${filename}`. They contain the role of the message (user, assistant, system), the content of the message, and any additional metadata such as visibility and sometimes type. The latter are important when data is being written to the buffer with `add_buf_message` as they allow the chat ui builder pattern to determine the type of message that it's receiving and therefore determine how to format it. In the example shared in `${filename}`, you can see how a user has prompted the LLM to use a tool and the chain of messages that lead to the LLM's final response.\"\ncodecompanion-workspace.json:136: \"description\": \"The message builder coordinates the entire process of adding content to the chat buffer. It uses a fluent interface to chain operations: adding headers when roles change, formatting content through specialized formatters, writing to the buffer with proper folding, and updating internal state. It is called from the chat buffer's `add_buf_message` method which occurs throughout the codebase.\"\ntests/helpers.lua:38: self:add_buf_message({\ntests/helpers.lua:95: chat:add_buf_message({ role = \"llm\", content = message })\ntests/helpers.lua:121: chat:add_buf_message({\ntests/helpers.lua:142: chat:add_buf_message({\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553d-f694-75f2-a417-d5c5e6516994","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_JuAWfz46dfO7vvbpAtQRjKOW","content":[{"type":"content","content":{"type":"text","text":"```sh\ncodecompanion-workspace.json:106: \"description\": \"Messages in the chat buffer are lua table objects as seen in `${filename}`. They contain the role of the message (user, assistant, system), the content of the message, and any additional metadata such as visibility and sometimes type. The latter are important when data is being written to the buffer with `add_buf_message` as they allow the chat ui builder pattern to determine the type of message that it's receiving and therefore determine how to format it. In the example shared in `${filename}`, you can see how a user has prompted the LLM to use a tool and the chain of messages that lead to the LLM's final response.\"\ncodecompanion-workspace.json:136: \"description\": \"The message builder coordinates the entire process of adding content to the chat buffer. It uses a fluent interface to chain operations: adding headers when roles change, formatting content through specialized formatters, writing to the buffer with proper folding, and updating internal state. It is called from the chat buffer's `add_buf_message` method which occurs throughout the codebase.\"\ntests/helpers.lua:38: self:add_buf_message({\ntests/helpers.lua:95: chat:add_buf_message({ role = \"llm\", content = message })\ntests/helpers.lua:121: chat:add_buf_message({\ntests/helpers.lua:142: chat:add_buf_message({\ntests/adapters/http/test_tools_in_chat_buffer.lua:93: self:add_buf_message(result.output, { type = \"llm_message\" })\ntests/adapters/http/test_tools_in_chat_buffer.lua:106: _G.chat:add_buf_message({\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553d-f694-75f2-a417-d5c5e6516994","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_JuAWfz46dfO7vvbpAtQRjKOW","content":[{"type":"content","content":{"type":"text","text":"```sh\ncodecompanion-workspace.json:106: \"description\": \"Messages in the chat buffer are lua table objects as seen in `${filename}`. They contain the role of the message (user, assistant, system), the content of the message, and any additional metadata such as visibility and sometimes type. The latter are important when data is being written to the buffer with `add_buf_message` as they allow the chat ui builder pattern to determine the type of message that it's receiving and therefore determine how to format it. In the example shared in `${filename}`, you can see how a user has prompted the LLM to use a tool and the chain of messages that lead to the LLM's final response.\"\ncodecompanion-workspace.json:136: \"description\": \"The message builder coordinates the entire process of adding content to the chat buffer. It uses a fluent interface to chain operations: adding headers when roles change, formatting content through specialized formatters, writing to the buffer with proper folding, and updating internal state. It is called from the chat buffer's `add_buf_message` method which occurs throughout the codebase.\"\ntests/helpers.lua:38: self:add_buf_message({\ntests/helpers.lua:95: chat:add_buf_message({ role = \"llm\", content = message })\ntests/helpers.lua:121: chat:add_buf_message({\ntests/helpers.lua:142: chat:add_buf_message({\ntests/adapters/http/test_tools_in_chat_buffer.lua:93: self:add_buf_message(result.output, { type = \"llm_message\" })\ntests/adapters/http/test_tools_in_chat_buffer.lua:106: _G.chat:add_buf_message({\nlua/codecompanion/interactions/chat/acp/handler.lua:165: self.chat:add_buf_message(\nlua/codecompanion/interactions/chat/acp/handler.lua:175: self.chat:add_buf_message(\nlua/codecompanion/interactions/chat/acp/handler.lua:205: self.chat:add_buf_message({\n```\n"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a553d-f694-75f2-a417-d5c5e6516994","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_JuAWfz46dfO7vvbpAtQRjKOW","content":[{"type":"content","content":{"type":"text","text":"```sh\ncodecompanion-workspace.json:106: \"description\": \"Messages in the chat buffer are lua table objects as seen in `${filename}`. They contain the role of the message (user, assistant, system), the content of the message, and any additional metadata such as visibility and sometimes type. The latter are important when data is being written to the buffer with `add_buf_message` as they allow the chat ui builder pattern to determine the type of message that it's receiving and therefore determine how to format it. In the example shared in `${filename}`, you can see how a user has prompted the LLM to use a tool and the chain of messages that lead to the LLM's final response.\"\ncodecompanion-workspace.json:136: \"description\": \"The message builder coordinates the entire process of adding content to the chat buffer. It uses a fluent interface to chain operations: adding headers when roles change, formatting content through specialized formatters, writing to the buffer with proper folding, and updating internal state. It is called from the chat buffer's `add_buf_message` method which occurs throughout the codebase.\"\ntests/helpers.lua:38: self:add_buf_message({\ntests/helpers.lua:95: chat:add_buf_message({ role = \"llm\", content = message })\ntests/helpers.lua:121: chat:add_buf_message({\ntests/helpers.lua:142: chat:add_buf_message({\ntests/adapters/http/test_tools_in_chat_buffer.lua:93: self:add_buf_message(result.output, { type = \"llm_message\" })\ntests/adapters/http/test_tools_in_chat_buffer.lua:106: _G.chat:add_buf_message({\nlua/codecompanion/interactions/chat/acp/handler.lua:165: self.chat:add_buf_message(\nlua/codecompanion/interactions/chat/acp/handler.lua:175: self.chat:add_buf_message(\nlua/codecompanion/interactions/chat/acp/handler.lua:205: self.chat:add_buf_message({\ntests/stubs/messages.lua:15: content = \"Can you search for `add_buf_message` using the grep_search tool?\",\ntests/stubs/messages.lua:39: arguments = '{\"query\":\"add_buf_message\"}',\ntests/stubs/messages.lua:49: content = \"<grepSearchTool>Searched text for `add_buf_message`, 27 results\\n```\\ncodecompanion-workspace.json:121 \\nhelpers.lua:40 tests\\nhelpers.lua:97 tests\\nhelpers.lua:127 tests\\nhelpers.lua:144 tests\\ntest_tools_in_chat_buffer.lua:66 tests/adapters\\ntest_tools_in_chat_buffer.lua:79 tests/adapters\\ntest_context.lua:128 tests/interactions/chat\\ntest_context.lua:193 tests/interactions/chat\\ntest_context.lua:205 tests/interactions/chat\\ntest_context.lua:342 tests/interactions/chat\\ntest_chat.lua:105 tests/interactions/chat\\ntest_chat.lua:122 tests/interactions/chat\\ntest_subscribers.lua:26 tests/interactions/chat\\ntest_subscribers.lua:31 tests/interactions/chat\\ntest_messages.lua:27 tests/interactions/chat\\ntest_tool_output.lua:62 tests/interactions/chat/tools/catalog\\ninit.lua:105 lua/codecompanion\\ninit.lua:65 lua/codecompanion/providers/completion\\ninit.lua:206 lua/codecompanion/interactions/chat\\ninit.lua:983 lua/codecompanion/interactions/chat\\ninit.lua:1174 lua/codecompanion/interactions/chat\\ninit.lua:1250 lua/codecompanion/interactions/chat\\ninit.lua:1287 lua/codecompanion/interactions/chat\\ninit.lua:195 lua/codecompanion/interactions\\ninit.lua:331 lua/codecompanion/interactions/chat/tools\\nnow.lua:19 lua/codecompanion/interactions/chat/slash_commands\\n```\\n\\nNOTE:\\n- The output format is {filename}:{line number} {filepath}.\\n- For example:\\ninit.lua:335 lua/codecompanion/interactions/chat/tools\\nRefers to line 335 of the init.lua file in the lua/codecompanion/interactions/chat/tools path</grepSearchTool>\",\ntests/stubs/messages.lua:64: content = \"The search for `add_buf_message` returned 27 results across multiple files, including `helpers.lua`, `init.lua`, and several test files.\\n\\nWould you like to see the code for a specific occurrence, or do you want a summary of how `add_buf_message` is used throughout the codebase?\",\n```\n"}}]}}}
When doing a web search:
Fetching a specific web page:
Some other, random tools I've observed:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call","toolCallId":"call_HN8cf3AxncMTCO9YvNSG7HOM","title":"Tool: codex/list_mcp_resources","status":"in_progress","rawInput":{"arguments":{"cursor":""},"server":"codex","tool":"list_mcp_resources"}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5371-5937-71c1-ab9b-6c04e09b7911","update":{"sessionUpdate":"tool_call_update","toolCallId":"call_HN8cf3AxncMTCO9YvNSG7HOM","status":"completed","content":[{"type":"content","content":{"type":"text","text":"{\"resources\":[]}"}}],"rawOutput":{"content":[{"text":"{\"resources\":[]}","type":"text"}],"isError":false}}}}