Skip to main content

Module query

Module query 

Source
Expand description

Core query/session management for Claude Code communication.

This module provides the Query struct, which handles the low-level communication protocol with the Claude Code CLI process, including:

  • Session initialization and handshake
  • Control request/response protocol (permissions, hooks, MCP)
  • Background message reading and routing via tokio tasks
  • Lifecycle management (interrupt, model change, rewind)

Most users should use ClaudeSdkClient or query() instead of interacting with this module directly.

Structs§

Query
Low-level query session handler for Claude Code CLI communication.

Functions§

handle_sdk_mcp_request
Routes an MCP message to the appropriate in-process SDK MCP server.