Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
tool_namespace.h File Reference

gh#145: the bridge's tool namespace, as a pure pair of functions. More...

#include <string>
Include dependency graph for tool_namespace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

std::string entropic::facade::qualify_tool_name (const std::string &prefix, const std::string &suffix)
 Qualify a bare tool suffix with the configured namespace.
 
std::string entropic::facade::strip_tool_prefix (const std::string &prefix, const std::string &name)
 Recover the bare suffix from a wire name.
 

Detailed Description

gh#145: the bridge's tool namespace, as a pure pair of functions.

A consumer app hosting this engine presents its OWN tools. The engine is a substrate, not the product — librentropic.so is deliberately consumable by more than one app, so the tools a given host exposes are properly that host's identity, not entropic's.

Extracted to a private facade header for the same reason final_text.h was (gh#130, v2.10.2): ExternalBridge::dispatch is private and the tools/list payload is only reachable over a real unix socket, so the naming rule would otherwise be testable only through an integration path. The rule is pure — two strings in, one string out — and belongs where a CPU unit test can reach it.

qualify and strip_tool_prefix are inverses. That property is asserted directly in tool_namespace_test.cpp, because the defect this replaces was exactly a build-name and a match-name drifting apart: before v2.12.0 the five tool names were written out twice, ~470 lines apart in external_bridge.cpp, with nothing tying them together.

Version
2.12.0

Definition in file tool_namespace.h.

Function Documentation

◆ qualify_tool_name()

std::string entropic::facade::qualify_tool_name ( const std::string &  prefix,
const std::string &  suffix 
)
inline

Qualify a bare tool suffix with the configured namespace.

Parameters
prefixConfigured mcp.external.tool_prefix. Empty means "no namespace" and yields the bare suffix — a deliberate escape hatch for a host that wants unqualified tool names.
suffixBare tool suffix ("ask", "status", ...).
Returns
"<prefix>.<suffix>", or suffix when prefix is empty. @req REQ-BRIDGE-001
Version
2.12.0

Definition at line 45 of file tool_namespace.h.

◆ strip_tool_prefix()

std::string entropic::facade::strip_tool_prefix ( const std::string &  prefix,
const std::string &  name 
)
inline

Recover the bare suffix from a wire name.

Inverse of qualify.

Matches the WHOLE configured prefix rather than stripping up to the first dot, and both halves of that matter:

  • a host configured as "acme.docs" must still dispatch its own tools;
  • a caller sending "entropic.ask" to a bridge configured as "sumac" must NOT silently resolve. That is a genuinely unknown tool there, and it is returned unchanged so the unknown-tool branch can report the name the caller actually sent rather than a mangled fragment.
Parameters
prefixConfigured mcp.external.tool_prefix.
nameFully-qualified tool name as received on the wire.
Returns
The bare suffix, or name unchanged when the prefix does not match. @req REQ-BRIDGE-001
Version
2.12.0

Definition at line 70 of file tool_namespace.h.