pub struct ClaudeConfigBuilder { /* private fields */ }Expand description
Builder for ClaudeConfig.
Implementations§
Source§impl ClaudeConfigBuilder
impl ClaudeConfigBuilder
Sourcepub fn preset(self, preset: Preset) -> Self
pub fn preset(self, preset: Preset) -> Self
Sets the preset that determines which CLI flags are auto-injected.
Defaults to Preset::Normal.
Sourcepub fn cli_path(self, path: impl Into<String>) -> Self
pub fn cli_path(self, path: impl Into<String>) -> Self
Sets the path to the claude CLI binary.
When not set, "claude" is resolved via PATH.
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> Self
pub fn system_prompt(self, prompt: impl Into<String>) -> Self
Sets the system prompt.
Sourcepub fn append_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn append_system_prompt(self, prompt: impl Into<String>) -> Self
Sets the append system prompt.
Sourcepub fn stream_idle_timeout(self, timeout: Duration) -> Self
pub fn stream_idle_timeout(self, timeout: Duration) -> Self
Sets the idle timeout for streams.
If no event arrives within this duration, the stream yields
ClaudeError::Timeout and terminates.
Sourcepub fn fallback_model(self, model: impl Into<String>) -> Self
pub fn fallback_model(self, model: impl Into<String>) -> Self
Sets the fallback model.
Sourcepub fn effort(self, effort: impl Into<String>) -> Self
pub fn effort(self, effort: impl Into<String>) -> Self
Sets the effort level. See effort constants for known values.
Sourcepub fn max_budget_usd(self, budget: f64) -> Self
pub fn max_budget_usd(self, budget: f64) -> Self
Sets the maximum budget in USD.
Sourcepub fn allowed_tools(
self,
tools: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn allowed_tools( self, tools: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Sets allowed tools (replaces any previous values).
Sourcepub fn add_allowed_tool(self, tool: impl Into<String>) -> Self
pub fn add_allowed_tool(self, tool: impl Into<String>) -> Self
Adds a single allowed tool.
Sourcepub fn disallowed_tools(
self,
tools: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn disallowed_tools( self, tools: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Sets disallowed tools (replaces any previous values).
Sourcepub fn add_disallowed_tool(self, tool: impl Into<String>) -> Self
pub fn add_disallowed_tool(self, tool: impl Into<String>) -> Self
Adds a single disallowed tool.
Sourcepub fn tools(self, tools: impl Into<String>) -> Self
pub fn tools(self, tools: impl Into<String>) -> Self
Sets the built-in tool set. "" disables all, "default" enables all.
Sourcepub fn mcp_configs(
self,
configs: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn mcp_configs( self, configs: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Sets MCP server configs (replaces any previous values).
Sourcepub fn add_mcp_config(self, config: impl Into<String>) -> Self
pub fn add_mcp_config(self, config: impl Into<String>) -> Self
Adds a single MCP server config.
Sourcepub fn setting_sources(self, sources: impl Into<String>) -> Self
pub fn setting_sources(self, sources: impl Into<String>) -> Self
Sets the setting sources to load.
Sourcepub fn settings(self, settings: impl Into<String>) -> Self
pub fn settings(self, settings: impl Into<String>) -> Self
Sets the path to a settings file or JSON string.
Sourcepub fn json_schema(self, schema: impl Into<String>) -> Self
pub fn json_schema(self, schema: impl Into<String>) -> Self
Sets the JSON Schema for structured output.
Sourcepub fn include_partial_messages(self, enabled: bool) -> Self
pub fn include_partial_messages(self, enabled: bool) -> Self
Enables or disables partial message chunks in stream output.
Sourcepub fn include_hook_events(self, enabled: bool) -> Self
pub fn include_hook_events(self, enabled: bool) -> Self
Enables or disables hook events in stream output.
Sourcepub fn permission_mode(self, mode: impl Into<String>) -> Self
pub fn permission_mode(self, mode: impl Into<String>) -> Self
Sets the permission mode. See permission_mode constants for known values.
Sourcepub fn dangerously_skip_permissions(self, enabled: bool) -> Self
pub fn dangerously_skip_permissions(self, enabled: bool) -> Self
Enables or disables bypassing all permission checks.
Sourcepub fn add_dirs(self, dirs: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn add_dirs(self, dirs: impl IntoIterator<Item = impl Into<String>>) -> Self
Sets additional directories (replaces any previous values).
Sourcepub fn files(self, files: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn files(self, files: impl IntoIterator<Item = impl Into<String>>) -> Self
Sets file resources (replaces any previous values).
Sourcepub fn session_id(self, id: impl Into<String>) -> Self
pub fn session_id(self, id: impl Into<String>) -> Self
Sets a specific session ID.
Sourcepub fn no_session_persistence(self, enabled: bool) -> Self
pub fn no_session_persistence(self, enabled: bool) -> Self
Enables or disables session persistence.
Enabled by default; set to false to allow session persistence.
Sourcepub fn disable_slash_commands(self, enabled: bool) -> Self
pub fn disable_slash_commands(self, enabled: bool) -> Self
Enables or disables slash commands.
Disabled by default; set to false to enable slash commands.
Sourcepub fn strict_mcp_config(self, enabled: bool) -> Self
pub fn strict_mcp_config(self, enabled: bool) -> Self
Enables or disables strict MCP config mode.
Enabled by default; set to false to allow non---mcp-config MCP servers.
Sourcepub fn extra_args(
self,
args: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn extra_args( self, args: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Sets arbitrary extra CLI arguments (replaces any previous values).
These are appended before the prompt. Use typed fields when available; duplicating a typed field here may cause unpredictable CLI behavior.
Sourcepub fn add_extra_arg(self, arg: impl Into<String>) -> Self
pub fn add_extra_arg(self, arg: impl Into<String>) -> Self
Adds a single extra CLI argument.
Sourcepub fn build(self) -> ClaudeConfig
pub fn build(self) -> ClaudeConfig
Builds the ClaudeConfig.
Trait Implementations§
Source§impl Clone for ClaudeConfigBuilder
impl Clone for ClaudeConfigBuilder
Source§fn clone(&self) -> ClaudeConfigBuilder
fn clone(&self) -> ClaudeConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more