cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::server::ToolContext Struct Reference

Invocation context passed to tool handlers. More...

#include <context.hpp>

Inheritance diagram for mcp::server::ToolContext:
mcp::server::SessionContext

Public Member Functions

SessionClient client () const noexcept
 Return a non-owning peer handle for this invocation's client.
 
bool cancelled () const noexcept
 Convenience check for cancellation-aware handlers.
 
- Public Member Functions inherited from mcp::server::SessionContext
SessionClient client () const noexcept
 Return a non-owning handle for the client on this session.
 

Public Attributes

protocol::Json arguments = protocol::Json::object()
 JSON arguments supplied with the tool call.
 
std::optional< protocol::TaskRequestParameterstask
 Optional task request metadata supplied with the tool call.
 
CancellationToken cancellation
 Cooperative cancellation token for task-aware executions.
 
- Public Attributes inherited from mcp::server::SessionContext
std::string session_id
 Logical MCP session id when the transport has one.
 
std::string remote_address
 Best-effort remote endpoint description such as "stdio" or an address.
 
std::unordered_map< std::string, std::string > headers
 Transport-supplied request headers or metadata for this message.
 
std::optional< std::string > http_method
 HTTP request method for HTTP-based transports.
 
std::optional< std::string > http_url
 Absolute HTTP request URL for HTTP-based transports.
 
std::optional< AuthIdentityauth_identity
 Authenticated principal produced by the configured AuthProvider.
 
Transporttransport = nullptr
 Borrowed transport used to create a ClientPeer for outbound messages.
 
std::weak_ptr< void > transport_lifetime
 Weak lifetime token supplied by the transport.
 

Detailed Description

Invocation context passed to tool handlers.

ToolContext copies the SessionContext metadata for the active request and adds tool arguments. It does not own the transport; client() returns a non-owning SessionClient for optional server-to-client calls during handling.


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