# `OzMcp.Structs.Root`
[🔗](https://github.com/oz-elixir/oz_mcp/blob/v0.9.0/lib/oz_mcp/structs/root.ex#L1)

Helper module used to build `Root` structure: a directory or file the
client lets the server work in.

_(MCP protocol: 2025-11-25)_

The client sends the roots; the server reads them with
`OzMcp.Client.list_roots/2`. This module builds the same map, for example
for a test double of a client. `uri` must be a `file://` URI.

## Short example:

```elixir
%Root{}
  |> Root.uri("file:///home/user/project")
  |> Root.name("Project")
  |> Root.build()
```

Result:

```elixir
%{uri: "file:///home/user/project", name: "Project"}
```

Specification: [Root](https://modelcontextprotocol.io/specification/2025-11-25/schema#root)

## Fields

| Field | Setter | Type | Required |
|---|---|---|---|
| `uri` | `uri/2` | string | yes |
| `name` | `name/2` | string | no |
| `_meta` | `_meta/2` | map | no |

# `t`

```elixir
@type t() :: %OzMcp.Structs.Root{
  _meta: map() | nil,
  name: String.t() | nil,
  uri: String.t()
}
```

# `build`

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

# `name`

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

# `uri`

```elixir
@spec uri(t(), String.t()) :: t()
```

---

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