cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::client::McpClientSession Class Reference

Convenience wrapper that owns a Client and exposes common MCP workflows. More...

#include <session.hpp>

Public Member Functions

 McpClientSession (std::unique_ptr< Transport > transport, McpClientSessionOptions options={})
 Constructs a session from a transport and initialization options.
 
core::Result< protocol::Jsoninitialize ()
 Sends the initialize request using the configured session options.
 
core::Result< core::Unitmark_initialized ()
 Sends the initialized notification.
 
core::Result< std::vector< protocol::Prompt > > discover_prompts ()
 Discovers one page of prompts.
 
core::Result< std::vector< protocol::Prompt > > discover_all_prompts ()
 Discovers all prompts by following pagination cursors.
 
core::Result< protocol::PromptsGetResultget_prompt (const protocol::PromptsGetParams &params)
 Gets a prompt using protocol parameters.
 
core::Result< std::vector< protocol::Resource > > discover_resources ()
 Discovers one page of resources.
 
core::Result< std::vector< protocol::Resource > > discover_all_resources ()
 Discovers all resources by following pagination cursors.
 
core::Result< protocol::ResourcesReadResultread_resource (const protocol::ResourcesReadParams &params)
 Reads a resource using protocol parameters.
 
core::Result< std::vector< protocol::ResourceTemplate > > discover_resource_templates ()
 Discovers one page of resource templates.
 
core::Result< std::vector< protocol::ResourceTemplate > > discover_all_resource_templates ()
 Discovers all resource templates by following pagination cursors.
 
core::Result< std::vector< protocol::ToolDefinition > > discover_tools ()
 Discovers one page of tools.
 
core::Result< std::vector< protocol::ToolDefinition > > discover_all_tools ()
 Discovers all tools by following pagination cursors.
 
core::Result< protocol::ToolResultcall_tool (const protocol::ToolCall &call)
 Calls a tool through the underlying Client.
 
core::Result< protocol::CompleteResultcomplete (const protocol::CompleteParams &params)
 Requests completion using typed protocol parameters.
 
core::Result< core::Unitset_level (std::string_view level)
 Sets the server logging level by level name.
 
core::Result< core::Unitsubscribe (std::string_view uri)
 Subscribes to resource update notifications for a URI.
 
core::Result< core::Unitunsubscribe (std::string_view uri)
 Unsubscribes from resource update notifications for a URI.
 
Clientclient ()
 Returns the mutable underlying Client.
 
const Clientclient () const
 Returns the underlying Client.
 

Detailed Description

Convenience wrapper that owns a Client and exposes common MCP workflows.

McpClientSession keeps the low-level Client available while naming common actions in terms of discovery and session lifecycle. It does not hide the underlying result model: all operations still return core::Result<T>.

Constructor & Destructor Documentation

◆ McpClientSession()

mcp::client::McpClientSession::McpClientSession ( std::unique_ptr< Transport transport,
McpClientSessionOptions  options = {} 
)
explicit

Constructs a session from a transport and initialization options.

Parameters
transportTransport owned by the underlying Client. It must not be null.
optionsClient name and version used by initialize().

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