Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
tool_base.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
13#pragma once
14
16
17#include <string>
18
19namespace entropic {
20
21struct ServerResponse; // forward declaration (server_base.h)
22
34 std::string name;
35 std::string description;
36 std::string input_schema;
37 std::string output_schema;
38};
39
52class ToolBase {
53public:
54 virtual ~ToolBase() = default;
55
61 explicit ToolBase(ToolDefinition def);
62
68 const std::string& name() const;
69
75 const ToolDefinition& definition() const;
76
83 virtual ServerResponse execute(const std::string& args_json) = 0;
84
95 virtual std::string anchor_key(const std::string& args_json) const;
96
107
108protected:
110};
111
123 const std::string& tool_name,
124 const std::string& server_prefix,
125 const std::string& data_dir);
126
140std::string render_response_format(const std::string& output_schema_json);
141
154std::string tool_error_json(const std::string& code, const std::string& message);
155
156} // namespace entropic
Abstract base class for individual MCP tools.
Definition tool_base.h:52
virtual ServerResponse execute(const std::string &args_json)=0
Execute this tool with the given arguments.
const std::string & name() const
Get the tool name.
Definition tool_base.cpp:40
ToolDefinition definition_
Tool definition.
Definition tool_base.h:109
virtual MCPAccessLevel required_access_level() const
Minimum access level required to execute this tool.
Definition tool_base.cpp:80
virtual std::string anchor_key(const std::string &args_json) const
Generate anchor key for this tool result.
Definition tool_base.cpp:65
const ToolDefinition & definition() const
Get the full tool definition.
Definition tool_base.cpp:50
Configuration structs with defaults.
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
std::string render_response_format(const std::string &output_schema_json)
Render an outputSchema as the compact "Response format" text a model reads (gh#203).
Structured result from tool execution.
Definition server_base.h:33
Parsed tool definition from JSON schema file.
Definition tool_base.h:33
std::string name
Tool name (e.g., "read_file")
Definition tool_base.h:34
std::string input_schema
JSON Schema for arguments (raw JSON string)
Definition tool_base.h:36
std::string output_schema
JSON Schema for the result ("" = undeclared). v2.14.0.
Definition tool_base.h:37
std::string description
Human-readable description.
Definition tool_base.h:35