# `ExMCP.Server.Tools.ASTValidator`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/server/tools/ast_validator.ex#L1)

Validates AST nodes to ensure they are safe for evaluation.

> #### Deprecated {: .warning}
>
> Part of the deprecated `ExMCP.Server.Tools` API. **Planned for removal in 2.0.0.**

This module provides security validation for AST nodes that will be
evaluated using Code.eval_quoted, preventing code injection attacks.

# `validate_schema_ast`

```elixir
@spec validate_schema_ast(any()) :: {:ok, any()} | {:error, String.t()}
```

Validates that an AST node contains only safe constructs.

Returns {:ok, ast} if the AST is safe, or {:error, reason} if unsafe
constructs are detected.

## Examples

    iex> ASTValidator.validate_schema_ast({:%{}, [], [type: "string"]})
    {:ok, {:%{}, [], [type: "string"]}}
    
    iex> ASTValidator.validate_schema_ast({:eval, [], ["dangerous code"]})
    {:error, "Unsafe AST node: eval"}

---

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