# `ConduitMcp.Client`
[🔗](https://github.com/nyo16/conduit_mcp/blob/v0.10.1/lib/conduit_mcp/client.ex#L1)

Server-to-client request helpers for bidirectional MCP communication.

These functions allow MCP servers to send requests back to clients for:
- **Sampling** — request LLM inference from the client
- **Elicitation** — request user input via forms or URLs
- **Roots** — query client filesystem boundaries

## Important

Server-to-client requests require a bidirectional transport (SSE streaming or
equivalent). The client must declare the corresponding capability during initialization.

These are building blocks for advanced MCP features. They construct the
JSON-RPC request messages that need to be sent to the client via the active
transport connection.

# `create_message_request`

Builds a `sampling/createMessage` request to send to the client.

The client will use its LLM to generate a response based on the provided messages.

## Options

- `:model_preferences` - Model selection preferences
- `:system_prompt` - System prompt for the LLM
- `:max_tokens` - Maximum tokens in the response
- `:tools` - Tools available for the LLM to use
- `:tool_choice` - Tool selection mode ("auto", "required", "none")

## Example

    request = ConduitMcp.Client.create_message_request(
      [%{"role" => "user", "content" => %{"type" => "text", "text" => "Hello"}}],
      max_tokens: 1000
    )

# `elicit_request`

Builds an `elicitation/create` request (form mode) to send to the client.

The client will display a form to the user based on the provided JSON schema.

## Example

    request = ConduitMcp.Client.elicit_request(
      "Please provide your API key",
      %{
        "type" => "object",
        "properties" => %{"api_key" => %{"type" => "string", "title" => "API Key"}},
        "required" => ["api_key"]
      }
    )

# `list_roots_request`

Builds a `roots/list` request to send to the client.

The client will respond with its filesystem root boundaries.

# `log_notification`

Builds a log message notification to send to the client.

# `progress_notification`

Builds a progress notification to send to the client.

# `prompt_list_changed_notification`

Builds a prompt list changed notification.

# `resource_list_changed_notification`

Builds a resource list changed notification.

# `resource_updated_notification`

Builds a resource updated notification to send to the client.

# `tool_list_changed_notification`

Builds a tool list changed notification.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
