|
LLDB mainline
|
Classes | |
| struct | CallToolParams |
| Used by the client to invoke a tool provided by the server. More... | |
| struct | CallToolResult |
| The server’s response to a tool call. More... | |
| struct | ClientCapabilities |
| Capabilities a client may support. More... | |
| struct | Error |
| struct | Implementation |
| Describes the name and version of an MCP implementation, with an optional title for UI representation. More... | |
| struct | InitializeParams |
| Initialization. More... | |
| struct | InitializeResult |
| After receiving an initialize request from the client, the server sends this response. More... | |
| struct | ListResourcesResult |
| The server’s response to a resources/list request from the client. More... | |
| struct | ListToolsResult |
| The server's response to a tools/list request from the client. More... | |
| class | MCPError |
| struct | Notification |
| A notification which does not expect a response. More... | |
| struct | ProtocolDescriptor |
| struct | ReadResourceParams |
| Sent from the client to the server, to read a specific resource URI. More... | |
| struct | ReadResourceResult |
| The server's response to a resources/read request from the client. More... | |
| struct | Request |
| A request that expects a response. More... | |
| struct | Resource |
| A known resource that the server is capable of reading. More... | |
| class | ResourceProvider |
| struct | Response |
| A response to a request, either an error or a result. More... | |
| class | Server |
| struct | ServerCapabilities |
| Capabilities that a server may support. More... | |
| struct | ServerInfo |
| Information about this instance of lldb's MCP server for lldb-mcp to use to coordinate connecting an lldb-mcp client. More... | |
| class | ServerInfoHandle |
| A handle that tracks the server info on disk and cleans up the disk record once it is no longer referenced. More... | |
| struct | TextContent |
| Text provided to or from an LLM. More... | |
| struct | TextResourceContents |
| The contents of a specific resource or sub-resource. More... | |
| class | Tool |
| struct | ToolDefinition |
| Definition for a tool the client can call. More... | |
| class | Transport |
| class | UnsupportedURI |
Typedefs | |
| using | Id = std::variant<int64_t, std::string> |
| A Request or Response 'id'. | |
| using | Message = std::variant<Request, Response, Notification> |
| A general message as defined by the JSON-RPC 2.0 spec. | |
| using | ToolArguments = std::variant<std::monostate, llvm::json::Value> |
| using | Void = std::monostate |
| Special case parameter or result that has no value. | |
| using | ContentBlock = TextContent |
| Supported content types, currently only TextContent, but the spec includes additional content types. | |
| using | MCPTransport = lldb_private::transport::JSONTransport<ProtocolDescriptor> |
| Generic transport that uses the MCP protocol. | |
| using | MCPBinder = lldb_private::transport::Binder<ProtocolDescriptor> |
| using | MCPBinderUP = std::unique_ptr<MCPBinder> |
| using | LogCallback = llvm::unique_function<void(llvm::StringRef message)> |
| Generic logging callback, to allow the MCP server / client / transport layer to be independent of the lldb log implementation. | |
Enumerations | |
| enum | ErrorCode : signed { eErrorCodeParseError = -32700 , eErrorCodeInvalidRequest = -32600 , eErrorCodeMethodNotFound = -32601 , eErrorCodeInvalidParams = -32602 , eErrorCodeInternalError = -32603 } |
Functions | |
| llvm::json::Value | toJSON (const Request &) |
| bool | fromJSON (const llvm::json::Value &, Request &, llvm::json::Path) |
| bool | operator== (const Request &, const Request &) |
| llvm::json::Value | toJSON (const Error &) |
| bool | fromJSON (const llvm::json::Value &, Error &, llvm::json::Path) |
| bool | operator== (const Error &, const Error &) |
| llvm::json::Value | toJSON (const Response &) |
| bool | fromJSON (const llvm::json::Value &, Response &, llvm::json::Path) |
| bool | operator== (const Response &, const Response &) |
| llvm::json::Value | toJSON (const Notification &) |
| bool | fromJSON (const llvm::json::Value &, Notification &, llvm::json::Path) |
| bool | operator== (const Notification &, const Notification &) |
| bool | fromJSON (const llvm::json::Value &, Message &, llvm::json::Path) |
| llvm::json::Value | toJSON (const Message &) |
| llvm::json::Value | toJSON (const Resource &) |
| bool | fromJSON (const llvm::json::Value &, Resource &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ListResourcesResult &) |
| bool | fromJSON (const llvm::json::Value &, ListResourcesResult &, llvm::json::Path) |
| llvm::json::Value | toJSON (const TextResourceContents &) |
| bool | fromJSON (const llvm::json::Value &, TextResourceContents &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ReadResourceParams &) |
| bool | fromJSON (const llvm::json::Value &, ReadResourceParams &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ReadResourceResult &) |
| bool | fromJSON (const llvm::json::Value &, ReadResourceResult &, llvm::json::Path) |
| llvm::json::Value | toJSON (const TextContent &) |
| bool | fromJSON (const llvm::json::Value &, TextContent &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ToolDefinition &) |
| bool | fromJSON (const llvm::json::Value &, ToolDefinition &, llvm::json::Path) |
| llvm::json::Value | toJSON (const Implementation &) |
| bool | fromJSON (const llvm::json::Value &, Implementation &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ClientCapabilities &) |
| bool | fromJSON (const llvm::json::Value &, ClientCapabilities &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ServerCapabilities &) |
| bool | fromJSON (const llvm::json::Value &, ServerCapabilities &, llvm::json::Path) |
| llvm::json::Value | toJSON (const InitializeParams &) |
| bool | fromJSON (const llvm::json::Value &, InitializeParams &, llvm::json::Path) |
| llvm::json::Value | toJSON (const InitializeResult &) |
| bool | fromJSON (const llvm::json::Value &, InitializeResult &, llvm::json::Path) |
| llvm::json::Value | toJSON (const Void &) |
| bool | fromJSON (const llvm::json::Value &, Void &, llvm::json::Path) |
| llvm::json::Value | toJSON (const ListToolsResult &) |
| bool | fromJSON (const llvm::json::Value &, ListToolsResult &, llvm::json::Path) |
| llvm::json::Value | toJSON (const CallToolParams &) |
| bool | fromJSON (const llvm::json::Value &, CallToolParams &, llvm::json::Path) |
| llvm::json::Value | toJSON (const CallToolResult &) |
| bool | fromJSON (const llvm::json::Value &, CallToolResult &, llvm::json::Path) |
| lldb_protocol::mcp::Request | MakeRequest (int64_t id, llvm::StringRef method, std::optional< llvm::json::Value > params) |
| llvm::json::Value | toJSON (const ServerInfo &) |
| bool | fromJSON (const llvm::json::Value &, ServerInfo &, llvm::json::Path) |
| static bool | mapRaw (const json::Value &Params, StringLiteral Prop, std::optional< json::Value > &V, json::Path P) |
| static llvm::json::Value | toJSON (const Id &Id) |
| static bool | mapId (const llvm::json::Value &V, StringLiteral Prop, Id &Id, llvm::json::Path P) |
| bool | fromJSON (const json::Value &V, Implementation &I, json::Path P) |
| bool | fromJSON (const json::Value &, ClientCapabilities &, json::Path) |
| bool | fromJSON (const json::Value &V, ServerCapabilities &C, json::Path P) |
| bool | fromJSON (const json::Value &V, InitializeParams &I, json::Path P) |
| bool | fromJSON (const json::Value &V, InitializeResult &R, json::Path P) |
| bool | fromJSON (const json::Value &V, ListToolsResult &R, json::Path P) |
| bool | fromJSON (const json::Value &V, CallToolResult &R, json::Path P) |
| bool | fromJSON (const json::Value &V, CallToolParams &R, json::Path P) |
| bool | fromJSON (const json::Value &V, ReadResourceParams &R, json::Path P) |
| bool | fromJSON (const json::Value &V, ListResourcesResult &R, json::Path P) |
| bool | fromJSON (const json::Value &V, Void &R, json::Path P) |
Variables | |
| static llvm::StringLiteral | kProtocolVersion = "2024-11-05" |
Supported content types, currently only TextContent, but the spec includes additional content types.
Definition at line 289 of file Protocol.h.
| using lldb_protocol::mcp::Id = std::variant<int64_t, std::string> |
NOTE: This differs from the JSON-RPC 2.0 spec. The MCP spec says this must be a string or number, excluding a json 'null' as a valid id.
Definition at line 32 of file Protocol.h.
| using lldb_protocol::mcp::LogCallback = llvm::unique_function<void(llvm::StringRef message)> |
Generic logging callback, to allow the MCP server / client / transport layer to be independent of the lldb log implementation.
Definition at line 81 of file Transport.h.
Definition at line 76 of file Transport.h.
| using lldb_protocol::mcp::MCPBinderUP = std::unique_ptr<MCPBinder> |
Definition at line 77 of file Transport.h.
Generic transport that uses the MCP protocol.
Definition at line 75 of file Transport.h.
| using lldb_protocol::mcp::Message = std::variant<Request, Response, Notification> |
A general message as defined by the JSON-RPC 2.0 spec.
Definition at line 100 of file Protocol.h.
| using lldb_protocol::mcp::ToolArguments = std::variant<std::monostate, llvm::json::Value> |
Definition at line 191 of file Protocol.h.
| using lldb_protocol::mcp::Void = std::monostate |
Special case parameter or result that has no value.
Definition at line 276 of file Protocol.h.
| enum lldb_protocol::mcp::ErrorCode : signed |
| Enumerator | |
|---|---|
| eErrorCodeParseError | Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. |
| eErrorCodeInvalidRequest | The JSON sent is not a valid Request object. |
| eErrorCodeMethodNotFound | The method does not exist / is not available. |
| eErrorCodeInvalidParams | Invalid method parameter(s). |
| eErrorCodeInternalError | Internal JSON-RPC error. |
Definition at line 47 of file Protocol.h.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | , |
| ClientCapabilities & | , | ||
| json::Path | ) |
Definition at line 305 of file Protocol.cpp.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| CallToolParams & | R, | ||
| json::Path | P ) |
Definition at line 416 of file Protocol.cpp.
References lldb_protocol::mcp::CallToolParams::arguments, mapRaw(), and lldb_protocol::mcp::CallToolParams::name.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| CallToolResult & | R, | ||
| json::Path | P ) |
Definition at line 400 of file Protocol.cpp.
References lldb_protocol::mcp::CallToolResult::content, lldb_protocol::mcp::CallToolResult::isError, mapRaw(), and lldb_protocol::mcp::CallToolResult::structuredContent.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| Implementation & | I, | ||
| json::Path | P ) |
Definition at line 297 of file Protocol.cpp.
References lldb_protocol::mcp::Implementation::name, lldb_protocol::mcp::Implementation::title, and lldb_protocol::mcp::Implementation::version.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| InitializeParams & | I, | ||
| json::Path | P ) |
Definition at line 354 of file Protocol.cpp.
References lldb_protocol::mcp::InitializeParams::capabilities, lldb_protocol::mcp::InitializeParams::clientInfo, and lldb_protocol::mcp::InitializeParams::protocolVersion.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| InitializeResult & | R, | ||
| json::Path | P ) |
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| ListResourcesResult & | R, | ||
| json::Path | P ) |
Definition at line 434 of file Protocol.cpp.
References lldb_protocol::mcp::ListResourcesResult::resources.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| ListToolsResult & | R, | ||
| json::Path | P ) |
Definition at line 384 of file Protocol.cpp.
References lldb_protocol::mcp::ListToolsResult::tools.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| ReadResourceParams & | R, | ||
| json::Path | P ) |
Definition at line 425 of file Protocol.cpp.
References lldb_protocol::mcp::ReadResourceParams::uri.
| bool lldb_protocol::mcp::fromJSON | ( | const json::Value & | V, |
| ServerCapabilities & | C, | ||
| json::Path | P ) |
Definition at line 333 of file Protocol.cpp.
References lldb_protocol::mcp::ServerCapabilities::supportsToolsList.
Definition at line 441 of file Protocol.cpp.
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| CallToolParams & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| CallToolResult & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| ClientCapabilities & | , | ||
| llvm::json::Path | ) |
Definition at line 91 of file Protocol.cpp.
References lldb_protocol::mcp::Error::code, lldb_protocol::mcp::Error::data, mapRaw(), and lldb_protocol::mcp::Error::message.
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| Implementation & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| InitializeParams & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| InitializeResult & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| ListResourcesResult & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| ListToolsResult & | , | ||
| llvm::json::Path | ) |
Definition at line 242 of file Protocol.cpp.
References fromJSON().
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | V, |
| Notification & | N, | ||
| llvm::json::Path | P ) |
Definition at line 154 of file Protocol.cpp.
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| ReadResourceParams & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | V, |
| ReadResourceResult & | RR, | ||
| llvm::json::Path | P ) |
Definition at line 204 of file Protocol.cpp.
References lldb_protocol::mcp::ReadResourceResult::contents.
Definition at line 74 of file Protocol.cpp.
References lldb_protocol::mcp::Request::id, mapId(), mapRaw(), lldb_protocol::mcp::Request::method, and lldb_protocol::mcp::Request::params.
Referenced by fromJSON(), and fromJSON().
Definition at line 170 of file Protocol.cpp.
References lldb_protocol::mcp::Resource::description, lldb_protocol::mcp::Resource::mimeType, lldb_protocol::mcp::Resource::name, and lldb_protocol::mcp::Resource::uri.
Definition at line 111 of file Protocol.cpp.
References error(), fromJSON(), lldb_protocol::mcp::Response::id, mapId(), and lldb_protocol::mcp::Response::result.
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| ServerCapabilities & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | , |
| ServerInfo & | , | ||
| llvm::json::Path | ) |
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | V, |
| TextContent & | TC, | ||
| llvm::json::Path | P ) |
Definition at line 214 of file Protocol.cpp.
References lldb_protocol::mcp::TextContent::text.
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | V, |
| TextResourceContents & | RC, | ||
| llvm::json::Path | P ) |
Definition at line 193 of file Protocol.cpp.
References lldb_protocol::mcp::TextResourceContents::mimeType, lldb_protocol::mcp::TextResourceContents::text, and lldb_protocol::mcp::TextResourceContents::uri.
| bool lldb_protocol::mcp::fromJSON | ( | const llvm::json::Value & | V, |
| ToolDefinition & | TD, | ||
| llvm::json::Path | P ) |
Definition at line 228 of file Protocol.cpp.
References lldb_protocol::mcp::ToolDefinition::description, lldb_protocol::mcp::ToolDefinition::inputSchema, mapRaw(), and lldb_protocol::mcp::ToolDefinition::name.
| lldb_protocol::mcp::Request lldb_protocol::mcp::MakeRequest | ( | int64_t | id, |
| llvm::StringRef | method, | ||
| std::optional< llvm::json::Value > | params ) |
|
static |
Definition at line 38 of file Protocol.cpp.
Referenced by fromJSON(), and fromJSON().
|
static |
Definition at line 17 of file Protocol.cpp.
Referenced by fromJSON(), fromJSON(), fromJSON(), fromJSON(), and fromJSON().
Definition at line 97 of file Protocol.cpp.
References lldb_protocol::mcp::Error::code, lldb_protocol::mcp::Error::data, and lldb_protocol::mcp::Error::message.
| bool lldb_protocol::mcp::operator== | ( | const Notification & | a, |
| const Notification & | b ) |
Definition at line 166 of file Protocol.cpp.
References lldb_protocol::mcp::Notification::method, and lldb_protocol::mcp::Notification::params.
Definition at line 80 of file Protocol.cpp.
References lldb_protocol::mcp::Request::id, lldb_protocol::mcp::Request::method, and lldb_protocol::mcp::Request::params.
Definition at line 143 of file Protocol.cpp.
References lldb_protocol::mcp::Response::id, and lldb_protocol::mcp::Response::result.
| json::Value lldb_protocol::mcp::toJSON | ( | const CallToolParams & | R | ) |
Definition at line 407 of file Protocol.cpp.
References lldb_protocol::mcp::CallToolParams::arguments, and lldb_protocol::mcp::CallToolParams::name.
| json::Value lldb_protocol::mcp::toJSON | ( | const CallToolResult & | R | ) |
Definition at line 389 of file Protocol.cpp.
References lldb_protocol::mcp::CallToolResult::content, lldb_protocol::mcp::CallToolResult::isError, and lldb_protocol::mcp::CallToolResult::structuredContent.
| json::Value lldb_protocol::mcp::toJSON | ( | const ClientCapabilities & | C | ) |
Definition at line 303 of file Protocol.cpp.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const Error & | E | ) |
Definition at line 84 of file Protocol.cpp.
References lldb_protocol::mcp::Error::code, lldb_protocol::mcp::Error::data, and lldb_protocol::mcp::Error::message.
|
static |
Definition at line 30 of file Protocol.cpp.
| json::Value lldb_protocol::mcp::toJSON | ( | const Implementation & | I | ) |
Definition at line 288 of file Protocol.cpp.
References lldb_protocol::mcp::Implementation::name, lldb_protocol::mcp::Implementation::title, and lldb_protocol::mcp::Implementation::version.
| json::Value lldb_protocol::mcp::toJSON | ( | const InitializeParams & | P | ) |
Definition at line 346 of file Protocol.cpp.
References lldb_protocol::mcp::InitializeParams::capabilities, lldb_protocol::mcp::InitializeParams::clientInfo, and lldb_protocol::mcp::InitializeParams::protocolVersion.
| json::Value lldb_protocol::mcp::toJSON | ( | const InitializeResult & | R | ) |
| json::Value lldb_protocol::mcp::toJSON | ( | const ListResourcesResult & | R | ) |
Definition at line 430 of file Protocol.cpp.
References lldb_protocol::mcp::ListResourcesResult::resources.
| json::Value lldb_protocol::mcp::toJSON | ( | const ListToolsResult & | R | ) |
Definition at line 380 of file Protocol.cpp.
References lldb_protocol::mcp::ListToolsResult::tools.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const Message & | M | ) |
Definition at line 238 of file Protocol.cpp.
References toJSON().
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const Notification & | N | ) |
Definition at line 147 of file Protocol.cpp.
| json::Value lldb_protocol::mcp::toJSON | ( | const ReadResourceParams & | R | ) |
Definition at line 421 of file Protocol.cpp.
References lldb_protocol::mcp::ReadResourceParams::uri.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const ReadResourceResult & | RR | ) |
Definition at line 200 of file Protocol.cpp.
References lldb_protocol::mcp::ReadResourceResult::contents.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const Request & | R | ) |
Definition at line 66 of file Protocol.cpp.
References lldb_protocol::mcp::Request::id, lldb_protocol::mcp::Request::method, lldb_protocol::mcp::Request::params, and toJSON().
Referenced by toJSON(), toJSON(), toJSON(), and lldb_protocol::mcp::ServerInfo::Write().
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const Resource & | R | ) |
Definition at line 177 of file Protocol.cpp.
References lldb_protocol::mcp::Resource::description, lldb_protocol::mcp::Resource::mimeType, lldb_protocol::mcp::Resource::name, and lldb_protocol::mcp::Resource::uri.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const Response & | R | ) |
Definition at line 101 of file Protocol.cpp.
References error(), lldb_protocol::mcp::Response::id, lldb_protocol::mcp::Response::result, and toJSON().
| json::Value lldb_protocol::mcp::toJSON | ( | const ServerCapabilities & | C | ) |
Definition at line 309 of file Protocol.cpp.
References lldb_protocol::mcp::ServerCapabilities::supportsCompletions, lldb_protocol::mcp::ServerCapabilities::supportsLogging, lldb_protocol::mcp::ServerCapabilities::supportsResourcesList, lldb_protocol::mcp::ServerCapabilities::supportsResourcesSubscribe, and lldb_protocol::mcp::ServerCapabilities::supportsToolsList.
| json::Value lldb_protocol::mcp::toJSON | ( | const ServerInfo & | SM | ) |
Definition at line 51 of file Server.cpp.
References lldb_protocol::mcp::ServerInfo::connection_uri.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const TextContent & | TC | ) |
Definition at line 210 of file Protocol.cpp.
References lldb_protocol::mcp::TextContent::text.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const TextResourceContents & | RC | ) |
Definition at line 186 of file Protocol.cpp.
References lldb_protocol::mcp::TextResourceContents::mimeType, lldb_protocol::mcp::TextResourceContents::text, and lldb_protocol::mcp::TextResourceContents::uri.
| llvm::json::Value lldb_protocol::mcp::toJSON | ( | const ToolDefinition & | TD | ) |
Definition at line 219 of file Protocol.cpp.
References lldb_protocol::mcp::ToolDefinition::description, lldb_protocol::mcp::ToolDefinition::inputSchema, and lldb_protocol::mcp::ToolDefinition::name.
| json::Value lldb_protocol::mcp::toJSON | ( | const Void & | R | ) |
Definition at line 439 of file Protocol.cpp.
|
static |
Definition at line 26 of file Protocol.h.
Referenced by lldb_protocol::mcp::Server::InitializeHandler().