.codecompanion/acp/claude_code_acp.md
This file shows the Claude Code ACP adapter's JSON RPC output when various tools are called.
When editing a file:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01VRjmb5Vsv9WwwKu6cgH8a4","sessionUpdate":"tool_call","rawInput":{},"status":"pending","title":"Write","kind":"edit","content":[],"locations":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01VRjmb5Vsv9WwwKu6cgH8a4","sessionUpdate":"tool_call","rawInput":{"file_path":"/Users/Oli/Code/Neovim/codecompanion.nvim/quotes.lua","content":"-- Simple test comment for ACP capture\nreturn {}\n"},"status":"pending","title":"Write /Users/Oli/Code/Neovim/codecompanion.nvim/quotes.lua","kind":"edit","content":[{"type":"diff","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/quotes.lua","oldText":null,"newText":"-- Simple test comment for ACP capture\nreturn {}\n"}],"locations":[{"path":"/Users/Oli/Code/Neovim/codecompanion.nvim/quotes.lua"}]}}}
{"jsonrpc":"2.0","id":6,"method":"session/request_permission","params":{"options":[{"kind":"allow_always","name":"Always Allow","optionId":"allow_always"},{"kind":"allow_once","name":"Allow","optionId":"allow"},{"kind":"reject_once","name":"Reject","optionId":"reject"}],"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","toolCall":{"toolCallId":"toolu_01VRjmb5Vsv9WwwKu6cgH8a4","rawInput":{"file_path":"/Users/Oli/Code/Neovim/codecompanion.nvim/quotes.lua","content":"-- Simple test comment for ACP capture\nreturn {}\n"}}}}
{"jsonrpc":"2.0","id":6,"result":{"outcome":{"outcome":"selected","optionId":"allow_always"}}}
{"jsonrpc":"2.0","id":7,"method":"fs/write_text_file","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/quotes.lua","content":"-- Simple test comment for ACP capture\nreturn {}\n"}}
To read a file:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","update":{"toolCallId":"toolu_01LpQDoSXz49Yb64gPmXySai","sessionUpdate":"tool_call","rawInput":{},"status":"pending","title":"Read File","kind":"read","locations":[],"content":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","update":{"toolCallId":"toolu_01LpQDoSXz49Yb64gPmXySai","sessionUpdate":"tool_call","rawInput":{"file_path":"/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/acp/formatters.lua"},"status":"pending","title":"Read /Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/acp/formatters.lua","kind":"read","locations":[{"path":"/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/acp/formatters.lua","line":0}],"content":[]}}}
{"jsonrpc":"2.0","id":0,"method":"fs/read_text_file","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","path":"/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/acp/formatters.lua","line":1,"limit":2000}}
{"result":{"content":""},"jsonrpc":"2.0","id":0}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","update":{"toolCallId":"toolu_01LpQDoSXz49Yb64gPmXySai","sessionUpdate":"tool_call_update","status":"completed","content":[{"type":"content","content":{"type":"text","text":"```\n\n```"}}]}}}
When executing a command:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","update":{"toolCallId":"toolu_017FaiLJGYNSVToDmZhrHqhA","sessionUpdate":"tool_call","rawInput":{},"status":"pending","title":"Terminal","kind":"execute","content":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","update":{"toolCallId":"toolu_017FaiLJGYNSVToDmZhrHqhA","sessionUpdate":"tool_call","rawInput":{"command":"ls -la lua/codecompanion/interactions/chat/acp/formatters/","description":"List files in formatters directory"},"status":"pending","title":"`ls -la lua/codecompanion/interactions/chat/acp/formatters/`","kind":"execute","content":[{"type":"content","content":{"type":"text","text":"List files in formatters directory"}}]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a50a9-1217-7536-9bf1-ebb36898ca96","update":{"toolCallId":"toolu_017FaiLJGYNSVToDmZhrHqhA","sessionUpdate":"tool_call_update","status":"completed","content":[{"type":"content","content":{"type":"text","text":"total 56\ndrwxr-xr-x@ 6 Oli staff 192 4 Nov 18:04 .\ndrwxr-xr-x@ 7 Oli staff 224 4 Nov 18:05 ..\n-rw-r--r--@ 1 Oli staff 4153 4 Nov 18:04 claude_code.lua\n-rw-r--r--@ 1 Oli staff 3168 4 Nov 17:14 codex.lua\n-rw-r--r--@ 1 Oli staff 11006 4 Nov 17:14 default.lua\n-rw-r--r--@ 1 Oli staff 989 4 Nov 17:15 init.lua"}}]}}}
When searching for content and there's no data:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_019YPt8kXTaoKTadxdQjfims","sessionUpdate":"tool_call","rawInput":{},"status":"pending","title":"Find","kind":"search","content":[],"locations":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_019YPt8kXTaoKTadxdQjfims","sessionUpdate":"tool_call","rawInput":{"pattern":"**/*add_buf_message*"},"status":"pending","title":"Find `**/*add_buf_message*`","kind":"search","content":[],"locations":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_019YPt8kXTaoKTadxdQjfims","sessionUpdate":"tool_call_update","status":"completed","content":[{"type":"content","content":{"type":"text","text":"No files found"}}]}}}
When searching for content and there is data:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01JQYavcZoNrCK5uA4W8qmJw","sessionUpdate":"tool_call","rawInput":{},"status":"pending","title":"grep \"undefined\"","kind":"search","content":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01JQYavcZoNrCK5uA4W8qmJw","sessionUpdate":"tool_call","rawInput":{"pattern":"add_buf_message","output_mode":"files_with_matches"},"status":"pending","title":"grep \"add_buf_message\"","kind":"search","content":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01JQYavcZoNrCK5uA4W8qmJw","sessionUpdate":"tool_call_update","status":"completed","content":[{"type":"content","content":{"type":"text","text":"Found 22 files\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/test_chat.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/acp/handler.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/test_context.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/providers/completion/init.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/init.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/acp/test_handler.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/tools/init.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/chat/slash_commands/catalog/now.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/init.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/tools/test_tools.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/adapters/http/test_tools_in_chat_buffer.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/stubs/messages.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/lua/codecompanion/interactions/init.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/.codecompanion/chat.md\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/helpers.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/test_subscribers.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/codecompanion-workspace.json\n/Users/Oli/Code/Neovim/codecompanion.nvim/.codecompanion/ui.md\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/ui/test_fold_reasoning_output.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/ui/test_builder_state.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/tools/catalog/test_tool_output.lua\n/Users/Oli/Code/Neovim/codecompanion.nvim/tests/interactions/chat/test_messages.lua"}}]}}}
When doing a web search:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01Sej4My9Mncay2CPSKWkZAJ","sessionUpdate":"tool_call","rawInput":{},"status":"pending","title":"\"undefined\"","kind":"fetch","content":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01Sej4My9Mncay2CPSKWkZAJ","sessionUpdate":"tool_call","rawInput":{"query":"Sheffield United"},"status":"pending","title":"\"Sheffield United\"","kind":"fetch","content":[]}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a5121-cbef-746c-aece-adc08cef75cd","update":{"toolCallId":"toolu_01Sej4My9Mncay2CPSKWkZAJ","sessionUpdate":"tool_call_update","status":"completed","content":[{"type":"content","content":{"type":"text","text":"Web search results for query: \"Sheffield United\"\n\nLinks: [{\"title\":\"Wilder reacts to Sheffield United's defeat by Derby\",\"url\":\"https://www.aol.com/articles/wilder-reacts-sheffield-uniteds-defeat-184416563.html\"},{\"title\":\"Sheffield United F.C. - Wikipedia\",\"url\":\"https://en.wikipedia.org/wiki/Sheffield_United_F.C.\"},{\"title\":\"Sheffield United Scores, Stats and Highlights - ESPN\",\"url\":\"https://www.espn.com/soccer/team/_/id/398/sheffield-united\"},{\"title\":\"Sheffield United FC\",\"url\":\"https://www.sufc.co.uk/\"},{\"title\":\"Sheffield United (@SheffieldUnited) / X\",\"url\":\"https://x.com/SheffieldUnited\"},{\"title\":\"Sheffield United News, Fixtures, Results, Transfers | Sky Sports\",\"url\":\"https://www.skysports.com/sheffield-united\"},{\"title\":\"Sheffield United (@sheffieldunited) • Instagram photos and videos\",\"url\":\"https://www.instagram.com/sheffieldunited/\"},{\"title\":\"Sheffield United Team News, Fixtures & Results 2025/26 | Premier League\",\"url\":\"https://www.premierleague.com/en/clubs/49/sheffield-united/overview\"},{\"title\":\"Men's Team\",\"url\":\"https://www.sufc.co.uk/teams/\"},{\"title\":\"Sheffield United | Sheffield | Facebook\",\"url\":\"https://www.facebook.com/sheffieldunited/\"}]\n\nBased on the search results, here's information about Sheffield United:\n\n## Overview\nSheffield United Football Club is a professional football club based in Sheffield, South Yorkshire, England that competes in the EFL Championship, the second tier of English football.(no content)They are nicknamed \"the Blades\" due to Sheffield's history of cutlery production.\n\n## Home & History\nThe team have played home games at Bramall Lane since their formation.(no content)Sheffield United was formed as an offshoot of Sheffield United Cricket Club in 1889 and following strong performances in the Midland League and Northern League, they were invited to become a founding member of the Football League Second Division in 1892.\n\n## Recent News\nSheffield United manager Chris Wilder speaks to BBC Radio Sheffield after Saturday's 3-1 defeat by Derby County. This match occurred just three days ago.\n\n## League Status\nThe club played in the Premier League following a promotion from the EFL Championship in the 2022–23 season, but were relegated in the following season. They are currently competing in the Championship under manager Chris Wilder.\n\n## Rivals\nTheir main rivals are Sheffield Wednesday, with whom they contest the Steel City derby."}}]}}}
Fetching a specific web page:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a9608-3313-73bd-9f76-292536a97ff6","update":{"_meta":{"claudeCode":{"toolName":"WebFetch"}},"toolCallId":"toolu_01J8pCXnGC3oSe8uZ8GVguiL","sessionUpdate":"tool_call","rawInput":{"url":"https://agentclientprotocol.com/protocol/terminals","prompt":"Extract and summarize the complete terminal protocol specification including all methods, request/response formats, and key features."},"status":"pending","title":"Fetch https://agentclientprotocol.com/protocol/terminals","kind":"fetch","content":[{"type":"content","content":{"type":"text","text":"Extract and summarize the complete terminal protocol specification including all methods, request/response formats, and key features."}}]}}}
{"jsonrpc":"2.0","id":0,"method":"session/request_permission","params":{"options":[{"kind":"allow_always","name":"Always Allow","optionId":"allow_always"},{"kind":"allow_once","name":"Allow","optionId":"allow"},{"kind":"reject_once","name":"Reject","optionId":"reject"}],"sessionId":"019a9608-3313-73bd-9f76-292536a97ff6","toolCall":{"toolCallId":"toolu_01J8pCXnGC3oSe8uZ8GVguiL","rawInput":{"url":"https://agentclientprotocol.com/protocol/terminals","prompt":"Extract and summarize the complete terminal protocol specification including all methods, request/response formats, and key features."},"title":"Fetch https://agentclientprotocol.com/protocol/terminals"}}}
{"jsonrpc":"2.0","result":{"outcome":{"optionId":"allow","outcome":"selected"}},"id":0}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"019a9608-3313-73bd-9f76-292536a97ff6","update":{"_meta":{"claudeCode":{"toolResponse":{"bytes":7001,"code":200,"codeText":"OK","result":"# Terminal Protocol Specification Summary\n\n## Overview\nThe terminal protocol enables Claude agents to execute shell commands within a client's environment, with real-time output streaming and process management capabilities.\n\n## Capability Checking\nAgents must verify terminal support via the `initialize` response, checking that `clientCapabilities.terminal` is `true` before attempting any terminal operations.\n\n## Core Methods\n\n**terminal/create**\nInitiates a command in a new terminal. Parameters include command, arguments, environment variables, working directory, and output byte limits. Returns a terminal ID immediately for background execution.\n\n**terminal/output**\nRetrieves current command output without waiting for completion. Response includes output text, truncation status, and exit information if the process has finished.\n\n**terminal/wait_for_exit**\nBlocks until the command completes, returning the exit code and termination signal.\n\n**terminal/kill**\nTerminates a running command while preserving the terminal for further operations like output retrieval.\n\n**terminal/release**\nKills any running command and deallocates terminal resources. The terminal ID becomes invalid afterward.\n\n## Key Features\n\n- **Background Execution**: Commands run asynchronously, allowing agents to perform other operations\n- **Output Management**: \"Maximum number of output bytes to retain. Once exceeded, earlier output is truncated\" while maintaining character boundaries\n- **Tool Integration**: Terminals embed directly in tool calls for live user-facing output\n- **Timeout Implementation**: Agents can implement timeouts by racing `wait_for_exit` against a timer, then calling kill if needed\n- **Resource Management**: Agents must explicitly release terminals to prevent resource leaks","durationMs":5317,"url":"https://agentclientprotocol.com/protocol/terminals"},"toolName":"WebFetch"}},"toolCallId":"toolu_01J8pCXnGC3oSe8uZ8GVguiL","sessionUpdate":"tool_call_update"}}}