OzMcp.Structs.Root (OzMcp v0.9.0)

Copy Markdown View Source

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:

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

Result:

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

Specification: Root

Fields

FieldSetterTypeRequired
uriuri/2stringyes
namename/2stringno
_meta_meta/2mapno

Summary

Types

t()

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

Functions

build(struct)

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

name(struct, value)

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

uri(struct, value)

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