Entropic 2.11.1
Local-first agentic inference engine
Loading...
Searching...
No Matches
diagnostics.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
17
18#include <nlohmann/json.hpp>
19
20#include <string>
21
22static auto logger = entropic::log::get("mcp.diagnostics");
23
24namespace entropic {
25
26// ── DiagnosticsTool (stub) ──────────────────────────────────────
27
36class DiagnosticsTool : public ToolBase {
37public:
45 : ToolBase(std::move(def)) {}
46
56 }
57
65 ServerResponse execute(const std::string& args_json) override {
66 (void)args_json;
67 logger->info("[diagnostics] stub invoked");
68 return {"LSP diagnostics not yet connected (v1.8.7)", {}};
69 }
70};
71
72// ── CheckErrorsTool (stub) ──────────────────────────────────────
73
82class CheckErrorsTool : public ToolBase {
83public:
91 : ToolBase(std::move(def)) {}
92
102 }
103
111 ServerResponse execute(const std::string& args_json) override {
112 (void)args_json;
113 logger->info("[check_errors] stub invoked");
114 return {"LSP check_errors not yet connected (v1.8.7)", {}};
115 }
116};
117
118// ── DiagnosticsServer ───────────────────────────────────────────
119
134 const std::filesystem::path& root_dir,
135 const std::string& data_dir)
136 : MCPServerBase("diagnostics")
137 , root_dir_(root_dir) {
138
139 std::string tools_dir = data_dir + "/tools";
140
141 diagnostics_ = std::make_unique<DiagnosticsTool>(
143 "diagnostics", "diagnostics", tools_dir));
144
145 check_errors_ = std::make_unique<CheckErrorsTool>(
147 "check_errors", "diagnostics", tools_dir));
148
149 register_tool(diagnostics_.get());
150 register_tool(check_errors_.get());
151
152 logger->info("DiagnosticsServer initialized: root='{}'",
153 root_dir_.string());
154}
155
162
169const std::filesystem::path& DiagnosticsServer::root_dir() const {
170 return root_dir_;
171}
172
173} // namespace entropic
Stub tool for LSP error checking.
MCPAccessLevel required_access_level() const override
Read-only tool — requires READ access.
CheckErrorsTool(ToolDefinition def)
Construct with definition.
ServerResponse execute(const std::string &args_json) override
Return placeholder — LSP not yet connected.
DiagnosticsServer(const std::filesystem::path &root_dir, const std::string &data_dir)
Construct with root directory and data dir.
~DiagnosticsServer() override
Destructor.
const std::filesystem::path & root_dir() const
Get the root directory.
Stub tool for LSP diagnostics retrieval.
ServerResponse execute(const std::string &args_json) override
Return placeholder — LSP not yet connected.
DiagnosticsTool(ToolDefinition def)
Construct with definition.
MCPAccessLevel required_access_level() const override
Read-only tool — requires READ access.
Concrete base class for MCP servers (80% logic).
Definition server_base.h:66
void register_tool(ToolBase *tool)
Register a tool with this server.
Abstract base class for individual MCP tools.
Definition tool_base.h:45
Diagnostics MCP server — LSP client for code diagnostics.
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Definition logging.cpp:211
Activate model on GPU (WARM → ACTIVE).
ToolDefinition load_tool_definition(const std::string &tool_name, const std::string &server_prefix, const std::string &data_dir)
Load a tool definition from a JSON file.
Definition tool_base.cpp:99
MCPAccessLevel
MCP tool access level for per-identity authorization.
Definition config.h:38
@ READ
Read-only operations (e.g., read_file, list_directory)
MCPServerBase concrete base class + ServerResponse.
Structured result from tool execution.
Definition server_base.h:33
Parsed tool definition from JSON schema file.
Definition tool_base.h:27
Abstract base class for individual MCP tools.