Entropic 2.3.8
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
55 }
56
64 ServerResponse execute(const std::string& args_json) override {
65 (void)args_json;
66 logger->info("[diagnostics] stub invoked");
67 return {"LSP diagnostics not yet connected (v1.8.7)", {}};
68 }
69};
70
71// ── CheckErrorsTool (stub) ──────────────────────────────────────
72
81class CheckErrorsTool : public ToolBase {
82public:
90 : ToolBase(std::move(def)) {}
91
100 }
101
109 ServerResponse execute(const std::string& args_json) override {
110 (void)args_json;
111 logger->info("[check_errors] stub invoked");
112 return {"LSP check_errors not yet connected (v1.8.7)", {}};
113 }
114};
115
116// ── DiagnosticsServer ───────────────────────────────────────────
117
126 const std::filesystem::path& root_dir,
127 const std::string& data_dir)
128 : MCPServerBase("diagnostics")
129 , root_dir_(root_dir) {
130
131 std::string tools_dir = data_dir + "/tools";
132
133 diagnostics_ = std::make_unique<DiagnosticsTool>(
135 "diagnostics", "diagnostics", tools_dir));
136
137 check_errors_ = std::make_unique<CheckErrorsTool>(
139 "check_errors", "diagnostics", tools_dir));
140
141 register_tool(diagnostics_.get());
142 register_tool(check_errors_.get());
143
144 logger->info("DiagnosticsServer initialized: root='{}'",
145 root_dir_.string());
146}
147
154
161const std::filesystem::path& DiagnosticsServer::root_dir() const {
162 return root_dir_;
163}
164
165} // 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:81
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.