LLDB mainline
include/lldb/Protocol/MCP/Tool.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_PROTOCOL_MCP_TOOL_H
10#define LLDB_PROTOCOL_MCP_TOOL_H
11
13#include "llvm/Support/Error.h"
14#include "llvm/Support/JSON.h"
15#include <string>
16
17namespace lldb_protocol::mcp {
18
19class Tool {
20public:
21 Tool(std::string name, std::string description);
22 virtual ~Tool() = default;
23
24 virtual llvm::Expected<lldb_protocol::mcp::CallToolResult>
26
27 virtual std::optional<llvm::json::Value> GetSchema() const {
28 return llvm::json::Object{{"type", "object"}};
29 }
30
32
33 const std::string &GetName() { return m_name; }
34
35private:
36 std::string m_name;
37 std::string m_description;
38};
39
40} // namespace lldb_protocol::mcp
41
42#endif
Tool(std::string name, std::string description)
virtual std::optional< llvm::json::Value > GetSchema() const
virtual llvm::Expected< lldb_protocol::mcp::CallToolResult > Call(const lldb_protocol::mcp::ToolArguments &args)=0
lldb_protocol::mcp::ToolDefinition GetDefinition() const
virtual ~Tool()=default
std::variant< std::monostate, llvm::json::Value > ToolArguments
Definition Protocol.h:190
Definition for a tool the client can call.
Definition Protocol.h:177