# `LlmCore.Tool.Validator`
[🔗](https://github.com/fosferon/llm_core/blob/v0.3.0/lib/llm_core/tool/validator.ex#L1)

Validates tool call arguments against a tool's JSON Schema parameters.

Performs lightweight, built-in validation without requiring an external
JSON Schema library. Checks:

  * Required fields exist
  * Basic type checks (`string`, `number`, `integer`, `boolean`, `array`, `object`)
  * Enum membership when `"enum"` is specified in a property schema

This is intentionally a *subset* of JSON Schema validation — sufficient
for catching malformed LLM tool calls without pulling in a full schema
validator dependency.

# `validate_call`

```elixir
@spec validate_call(LlmToolkit.Tool.Call.t(), LlmToolkit.Tool.t()) ::
  :ok | {:error, [String.t()]}
```

Validates that a tool call's arguments satisfy the tool's parameter schema.

Returns `:ok` when valid, or `{:error, reasons}` with a list of human-readable
error strings.

## Examples

    iex> tool = %LlmToolkit.Tool{
    ...>   name: "search",
    ...>   description: "Search",
    ...>   parameters: %{
    ...>     "type" => "object",
    ...>     "properties" => %{
    ...>       "query" => %{"type" => "string"},
    ...>       "limit" => %{"type" => "integer"}
    ...>     },
    ...>     "required" => ["query"]
    ...>   },
    ...>   metadata: %{}
    ...> }
    iex> call = %LlmToolkit.Tool.Call{id: "1", name: "search", arguments: %{"query" => "hello"}}
    iex> LlmCore.Tool.Validator.validate_call(call, tool)
    :ok

    iex> bad_call = %LlmToolkit.Tool.Call{id: "2", name: "search", arguments: %{}}
    iex> LlmCore.Tool.Validator.validate_call(bad_call, tool)
    {:error, ["missing required field: query"]}

---

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