|
NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
|
Wraps a remote MCP server tool as a local Tool. More...
#include <client.h>
Public Member Functions | |
| asio::awaitable< std::string > | execute_async (const json &arguments) override |
| Execute the tool on the MCP server. | |
| asio::awaitable< std::string > | execute_async (const json &arguments, ToolExecutionContext context) override |
| What every dispatcher calls (ToolExecutionController): the call is bounded by the run's cancel token and deadline, as above. | |
| CallToolResult | execute_result (const json &arguments) |
| Typed execution preserving all content block kinds and MCP result fields. | |
| asio::awaitable< CallToolResult > | execute_result_async (const json &arguments, ToolExecutionContext context) |
| Typed execution bounded by the dispatcher's context: its cancel token and deadline stop waiting for the response, which is then dropped. | |
| ChatTool | get_definition () const override |
| Get the tool definition metadata. | |
| const ToolDefinition & | get_mcp_definition () const noexcept |
| Full MCP definition, including outputSchema and annotations. | |
| std::string | get_name () const override |
| Get the tool name. | |
| MCPTool (const std::string &server_url, const std::string &name, const std::string &description, const json &input_schema) | |
| Direct HTTP constructor for one known tool. | |
Public Member Functions inherited from neograph::AsyncTool | |
| std::string | execute (const json &arguments) final |
| Sync facade — drives execute_async on a private io_context. | |
Wraps a remote MCP server tool as a local Tool.
MCPTool implements the Tool interface through the originating protocol session, independently of which transport owns the connection.
| neograph::mcp::MCPTool::MCPTool | ( | const std::string & | server_url, |
| const std::string & | name, | ||
| const std::string & | description, | ||
| const json & | input_schema | ||
| ) |
Direct HTTP constructor for one known tool.
The tool opens one MCP session on its first call, reuses it for every later call, and ends it with DELETE when the tool is destroyed. server_url is the server's MCP endpoint URL, used as given. Prefer MCPClient(url).get_tools(), which shares one session among all of a server's tools and keeps their complete definitions.
|
overridevirtual |
Execute the tool on the MCP server.
| arguments | JSON object containing the tool's input parameters. |
Implements neograph::AsyncTool.
|
overridevirtual |
What every dispatcher calls (ToolExecutionController): the call is bounded by the run's cancel token and deadline, as above.
An isError result throws std::runtime_error, an ordinary tool failure.
Implements neograph::ContextualAsyncTool.
| asio::awaitable< CallToolResult > neograph::mcp::MCPTool::execute_result_async | ( | const json & | arguments, |
| ToolExecutionContext | context | ||
| ) |
Typed execution bounded by the dispatcher's context: its cancel token and deadline stop waiting for the response, which is then dropped.
Cancellation throws graph::CancelledException; a deadline or request timeout throws asio::system_error(asio::error::timed_out).
|
overridevirtual |
Get the tool definition metadata.
Returns a ChatTool containing the tool's name, description, and JSON Schema for its parameters. This is sent to the LLM so it can decide when to call the tool.
Implements neograph::Tool.
|
inlineoverridevirtual |
Get the tool name.
Implements neograph::Tool.