NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::mcp::MCPTool Class Reference

Wraps a remote MCP server tool as a local Tool. More...

#include <client.h>

Inheritance diagram for neograph::mcp::MCPTool:
[legend]
Collaboration diagram for neograph::mcp::MCPTool:
[legend]

Public Member Functions

std::string execute (const json &arguments) override
 Execute the tool on the MCP server.
 
ChatTool get_definition () const override
 Get the tool definition metadata.
 
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)
 HTTP-mode constructor.
 
 MCPTool (std::shared_ptr< detail::StdioSession > session, const std::string &name, const std::string &description, const json &input_schema)
 stdio-mode constructor.
 

Detailed Description

Wraps a remote MCP server tool as a local Tool.

MCPTool implements the Tool interface by forwarding execute() calls through the owning transport (HTTP or stdio). Created automatically by MCPClient::get_tools().

Definition at line 42 of file client.h.

Constructor & Destructor Documentation

◆ MCPTool() [1/2]

neograph::mcp::MCPTool::MCPTool ( const std::string &  server_url,
const std::string &  name,
const std::string &  description,
const json &  input_schema 
)

HTTP-mode constructor.

Each execute() opens an ephemeral MCPClient against server_url.

◆ MCPTool() [2/2]

neograph::mcp::MCPTool::MCPTool ( std::shared_ptr< detail::StdioSession >  session,
const std::string &  name,
const std::string &  description,
const json &  input_schema 
)

stdio-mode constructor.

The MCPTool keeps the session alive — the subprocess stays up as long as any tool instance holds a reference to it.

Member Function Documentation

◆ execute()

std::string neograph::mcp::MCPTool::execute ( const json &  arguments)
overridevirtual

Execute the tool on the MCP server.

Parameters
argumentsJSON object containing the tool's input parameters.
Returns
Result string (text content joined by newlines) or JSON dump.

Implements neograph::Tool.

◆ get_definition()

ChatTool neograph::mcp::MCPTool::get_definition ( ) const
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.

Returns
Tool definition including name, description, and parameter schema.

Implements neograph::Tool.

◆ get_name()

std::string neograph::mcp::MCPTool::get_name ( ) const
inlineoverridevirtual

Get the tool name.

Returns
Tool name string (must match the name in get_definition()).

Implements neograph::Tool.

Definition at line 68 of file client.h.


The documentation for this class was generated from the following file: