Entropic 2.14.3
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:
46
56 }
57
65 ServerResponse execute(const std::string& args_json) override {
67 logger->warn("[diagnostics] placeholder invoked — no language server is wired");
68 return {tool_error_json("not_implemented", "diagnostics is not implemented: no language "
69 "server is connected (mcp.enable_diagnostics)."),
70 {}};
71 }
72};
73
74// ── CheckErrorsTool (stub) ──────────────────────────────────────
75
84class CheckErrorsTool : public ToolBase {
85public:
94
104 }
105
113 ServerResponse execute(const std::string& args_json) override {
115 logger->warn("[check_errors] placeholder invoked — no language server is wired");
116 return {tool_error_json("not_implemented", "check_errors is not implemented: no language "
117 "server is connected (mcp.enable_diagnostics)."),
118 {}};
119 }
120};
121
122// ── DiagnosticsServer ───────────────────────────────────────────
123
138 const std::filesystem::path& root_dir,
139 const std::string& data_dir)
140 : MCPServerBase("diagnostics")
141 , root_dir_(root_dir) {
142
143 std::string tools_dir = data_dir + "/tools";
144
145 diagnostics_ = std::make_unique<DiagnosticsTool>(
147 "diagnostics", "diagnostics", tools_dir));
148
149 check_errors_ = std::make_unique<CheckErrorsTool>(
151 "check_errors", "diagnostics", tools_dir));
152
153 register_tool(diagnostics_.get());
154 register_tool(check_errors_.get());
155
156 logger->info("DiagnosticsServer initialized: root='{}'",
157 root_dir_.string());
158}
159
166
173const std::filesystem::path& DiagnosticsServer::root_dir() const {
174 return root_dir_;
175}
176
177} // 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 the declared not_implemented error (gh#174/#203).
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 the declared not_implemented error (gh#174/#203).
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:52
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.
@ optional
optional: every escape asks the host's path approver
std::string tool_error_json(const std::string &code, const std::string &message)
A declared tool error: {"error": code, "message": message}.
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:33
Abstract base class for individual MCP tools.