Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Protocol/MCP/Tool.h
213845 views
//===- Tool.h -------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_PLUGINS_PROTOCOL_MCP_TOOL_H9#define LLDB_PLUGINS_PROTOCOL_MCP_TOOL_H1011#include "Protocol.h"12#include "lldb/Core/Debugger.h"13#include "llvm/Support/JSON.h"14#include <string>1516namespace lldb_private::mcp {1718class Tool {19public:20Tool(std::string name, std::string description);21virtual ~Tool() = default;2223virtual llvm::Expected<protocol::TextResult>24Call(const protocol::ToolArguments &args) = 0;2526virtual std::optional<llvm::json::Value> GetSchema() const {27return llvm::json::Object{{"type", "object"}};28}2930protocol::ToolDefinition GetDefinition() const;3132const std::string &GetName() { return m_name; }3334private:35std::string m_name;36std::string m_description;37};3839class CommandTool : public mcp::Tool {40public:41using mcp::Tool::Tool;42~CommandTool() = default;4344virtual llvm::Expected<protocol::TextResult>45Call(const protocol::ToolArguments &args) override;4647virtual std::optional<llvm::json::Value> GetSchema() const override;48};4950} // namespace lldb_private::mcp5152#endif535455