|
Entropic 2.11.1
Local-first agentic inference engine
|
Client for an external MCP server (stdio or SSE). More...
#include <entropic/mcp/external_client.h>
Public Member Functions | |
| ExternalMCPClient (std::string name, std::unique_ptr< Transport > transport) | |
| Construct with name and transport. | |
| bool | connect () |
| Connect: open transport + MCP initialize + tools/list. | |
| void | disconnect () |
| Disconnect: close transport. | |
| std::string | list_tools () const |
| List tools as JSON array string (cached). | |
| std::string | execute (const std::string &tool_name, const std::string &args_json) |
| Execute a tool call via the external server. | |
| std::pair< std::vector< std::string >, std::vector< std::string > > | refresh_tools () |
| Re-query tools/list and diff against cache. | |
| bool | is_connected () const |
| Check connection state. | |
| const std::string & | name () const |
| Get server name. | |
| void | interrupt () |
| Abort any pending execute() by interrupting the transport. | |
Client for an external MCP server (stdio or SSE).
Owns a Transport instance. Handles MCP protocol negotiation, tool list caching, tool name prefixing, and response sanitization.
Definition at line 41 of file external_client.h.
| entropic::ExternalMCPClient::ExternalMCPClient | ( | std::string | name, |
| std::unique_ptr< Transport > | transport | ||
| ) |
Construct with name and transport.
| name | Server name (unique key, used as tool prefix). |
| transport | Ownership transferred. |
| name | Server name. |
| transport | Ownership transferred. @dg_internal |
Definition at line 27 of file external_client.cpp.
| bool entropic::ExternalMCPClient::connect | ( | ) |
Connect: open transport + MCP initialize + tools/list.
Connect: open transport, initialize, query tools.
The MCP handshake in order — transport open, initialize, tools/list.
Definition at line 45 of file external_client.cpp.
| void entropic::ExternalMCPClient::disconnect | ( | ) |
Disconnect: close transport.
Disconnect: close transport, clear cache.
@dg_internal
Definition at line 72 of file external_client.cpp.
| std::string entropic::ExternalMCPClient::execute | ( | const std::string & | tool_name, |
| const std::string & | args_json | ||
| ) |
Execute a tool call via the external server.
| tool_name | Local name (without server prefix). |
| args_json | JSON arguments string. |
| tool_name | Local name (without server prefix). |
| args_json | JSON arguments; unparseable arguments degrade to an empty object rather than throwing. |
Definition at line 107 of file external_client.cpp.
|
inline |
Abort any pending execute() by interrupting the transport.
Delegates to Transport::interrupt(). Safe to call concurrently from the engine's interrupt thread. (P1-10, 2.0.6-rc16)
@utility
Definition at line 114 of file external_client.h.
| bool entropic::ExternalMCPClient::is_connected | ( | ) | const |
Check connection state.
Check connection state via transport.
Definition at line 193 of file external_client.cpp.
| std::string entropic::ExternalMCPClient::list_tools | ( | ) | const |
List tools as JSON array string (cached).
List tools as JSON array string (cached, prefixed).
<server>.<tool>-prefixed, so ServerManager can concatenate them without re-prefixing; "[]" when disconnected. @req REQ-MCP-025 @req REQ-MCP-007 Definition at line 89 of file external_client.cpp.
|
inline |
Get server name.
Definition at line 103 of file external_client.h.
| std::pair< std::vector< std::string >, std::vector< std::string > > entropic::ExternalMCPClient::refresh_tools | ( | ) |
Re-query tools/list and diff against cache.
Called after a successful reconnect so the model's tool list tracks a server that changed while it was down.
Definition at line 168 of file external_client.cpp.