Skip to content

Commit 10dc840

Browse files
JDevliegherellvmbot
authored andcommitted
[lldb] Document MCP tools & resources (#148708)
Add documentation for the tools and resources exposed by LLDB's MCP server. (cherry picked from commit e8dc96d)
1 parent a0895b4 commit 10dc840

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

lldb/docs/use/mcp.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,69 @@ Configuration example for [Visual Studio Code](https://code.visualstudio.com/doc
7575
}
7676
```
7777

78-
### Troubleshooting
78+
## Tools
79+
80+
Tools are a primitive in the Model Context Protocol that enable servers to
81+
expose functionality to clients.
82+
83+
LLDB's MCP integration exposes one tool, named `lldb_command` which allows the
84+
model to run the same commands a user would type in the LLDB command
85+
interpreter. It takes two arguments:
86+
87+
1. The unique debugger ID as a number.
88+
2. The command and its arguments as a string.
89+
90+
## Resources
91+
92+
Resources are a primitive in the Model Context Protocol that allow servers to
93+
expose content that can be read by clients.
94+
95+
LLDB's MCP integration exposes a resource for each debugger and target
96+
instance. Debugger resources are accessible using the following URI:
97+
98+
```
99+
lldb://debugger/<debugger id>
100+
```
101+
102+
Example output:
103+
104+
```json
105+
{
106+
"contents": [
107+
{
108+
"uri": "lldb://debugger/1",
109+
"mimeType": "application/json",
110+
"text": "{\"debugger_id\":1,\"name\":\"debugger_1\",\"num_targets\":1}"
111+
}
112+
]
113+
}
114+
```
115+
116+
Debuggers can contain one or more targets, which are accessible using the
117+
following URI:
118+
119+
```
120+
lldb://debugger/<debugger id>/target/<target idx>
121+
```
122+
123+
Example output:
124+
125+
```json
126+
{
127+
"contents": [
128+
{
129+
"uri": "lldb://debugger/1/target/0",
130+
"mimeType": "application/json",
131+
"text": "{\"arch\":\"arm64-apple-macosx26.0.0\",\"debugger_id\":1,\"dummy\":false,\"path\":\"/bin/count\",\"platform\":\"host\",\"selected\":true,\"target_idx\":0}"
132+
}
133+
]
134+
}
135+
```
136+
137+
Note that unlike the debugger id, which is unique, the target index is not
138+
stable and may be reused when a target is removed and a new target is added.
139+
140+
## Troubleshooting
79141

80142
The MCP server uses the `Host` log channel. You can enable logging with the
81143
`log enable` command.

0 commit comments

Comments
 (0)