# `ClaudeAgentSDK.Permission.RuleValue`
[🔗](https://github.com/nshkrdotcom/claude_agent_sdk/blob/v0.17.2/lib/claude_agent_sdk/permission/rule_value.ex#L1)

Permission rule value struct.

Represents a single permission rule with a tool name and optional rule content
that defines the permission pattern.

## Examples

    # Simple tool permission
    RuleValue.new("Bash")

    # Tool permission with pattern
    RuleValue.new("Bash", "echo *")

    # File write permission with path pattern
    RuleValue.new("Write", "/tmp/**")

# `t`

```elixir
@type t() :: %ClaudeAgentSDK.Permission.RuleValue{
  extra: map(),
  rule_content: String.t() | nil,
  tool_name: String.t()
}
```

Permission rule value struct.

# `new`

```elixir
@spec new(String.t(), String.t() | nil) :: t()
```

Creates a new rule value.

## Parameters

- `tool_name` - Name of the tool this rule applies to
- `rule_content` - Optional content pattern for the rule

## Examples

    iex> RuleValue.new("Bash")
    %RuleValue{tool_name: "Bash", rule_content: nil}

    iex> RuleValue.new("Bash", "echo *")
    %RuleValue{tool_name: "Bash", rule_content: "echo *"}

# `parse`

```elixir
@spec parse(map() | t()) ::
  {:ok, t()}
  | {:error,
     {:invalid_permission_rule_value, CliSubprocessCore.Schema.error_detail()}}
```

# `parse!`

```elixir
@spec parse!(map() | t()) :: t()
```

# `schema`

```elixir
@spec schema() :: Zoi.schema()
```

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts a rule value to a map for the control protocol.

## Examples

    iex> RuleValue.new("Bash", "echo *") |> RuleValue.to_map()
    %{"toolName" => "Bash", "ruleContent" => "echo *"}

    iex> RuleValue.new("Bash") |> RuleValue.to_map()
    %{"toolName" => "Bash", "ruleContent" => nil}

---

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