File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ def _build_command(self) -> list[str]:
192192 # Preset object - 'claude_code' preset maps to 'default'
193193 cmd .extend (["--tools" , "default" ])
194194
195- if self ._options .allowed_tools :
195+ if self ._options .allowed_tools is not None :
196196 cmd .extend (["--allowedTools" , "," .join (self ._options .allowed_tools )])
197197
198198 if self ._options .max_turns :
@@ -201,7 +201,7 @@ def _build_command(self) -> list[str]:
201201 if self ._options .max_budget_usd is not None :
202202 cmd .extend (["--max-budget-usd" , str (self ._options .max_budget_usd )])
203203
204- if self ._options .disallowed_tools :
204+ if self ._options .disallowed_tools is not None :
205205 cmd .extend (["--disallowedTools" , "," .join (self ._options .disallowed_tools )])
206206
207207 if self ._options .model :
Original file line number Diff line number Diff line change @@ -717,15 +717,15 @@ class ClaudeAgentOptions:
717717 """Query options for Claude SDK."""
718718
719719 tools : list [str ] | ToolsPreset | None = None
720- allowed_tools : list [str ] = field ( default_factory = list )
720+ allowed_tools : list [str ] | None = None
721721 system_prompt : str | SystemPromptPreset | None = None
722722 mcp_servers : dict [str , McpServerConfig ] | str | Path = field (default_factory = dict )
723723 permission_mode : PermissionMode | None = None
724724 continue_conversation : bool = False
725725 resume : str | None = None
726726 max_turns : int | None = None
727727 max_budget_usd : float | None = None
728- disallowed_tools : list [str ] = field ( default_factory = list )
728+ disallowed_tools : list [str ] | None = None
729729 model : str | None = None
730730 fallback_model : str | None = None
731731 # Beta features - see https://docs.anthropic.com/en/api/beta-headers
Original file line number Diff line number Diff line change @@ -87,11 +87,11 @@ class TestOptions:
8787 def test_default_options (self ):
8888 """Test Options with default values."""
8989 options = ClaudeAgentOptions ()
90- assert options .allowed_tools == []
90+ assert options .allowed_tools is None
9191 assert options .system_prompt is None
9292 assert options .permission_mode is None
9393 assert options .continue_conversation is False
94- assert options .disallowed_tools == []
94+ assert options .disallowed_tools is None
9595
9696 def test_claude_code_options_with_tools (self ):
9797 """Test Options with built-in tools."""
You can’t perform that action at this time.
0 commit comments