|
cxxmcp 1.1.6
C++ MCP SDK
|
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::Json > | initialize () |
| Sends the initialize request using the configured session options. | |
| core::Result< core::Unit > | mark_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::PromptsGetResult > | get_prompt (const protocol::PromptsGetParams ¶ms) |
| 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::ResourcesReadResult > | read_resource (const protocol::ResourcesReadParams ¶ms) |
| 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::ToolResult > | call_tool (const protocol::ToolCall &call) |
| Calls a tool through the underlying Client. | |
| core::Result< protocol::CompleteResult > | complete (const protocol::CompleteParams ¶ms) |
| Requests completion using typed protocol parameters. | |
| core::Result< core::Unit > | set_level (std::string_view level) |
| Sets the server logging level by level name. | |
| core::Result< core::Unit > | subscribe (std::string_view uri) |
| Subscribes to resource update notifications for a URI. | |
| core::Result< core::Unit > | unsubscribe (std::string_view uri) |
| Unsubscribes from resource update notifications for a URI. | |
| Client & | client () |
| Returns the mutable underlying Client. | |
| const Client & | client () const |
| Returns the underlying Client. | |
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>.
|
explicit |
Constructs a session from a transport and initialization options.
| transport | Transport owned by the underlying Client. It must not be null. |
| options | Client name and version used by initialize(). |