LocalizeMcp.Index (Localize MCP v0.1.0)

View Source

Boot-time index of every documented module/function across :localize, :calendrical, and :localize_web (the latter two when loaded).

Built once during application start and cached in :persistent_term so individual tool handlers pay only a map lookup per call. Rebuild explicitly with rebuild/0 if a consumer hot-loads new modules at runtime — not the common case.

Each entry has the shape:

%{
  module: Localize.Number,
  function: :to_string,
  arity: 2,
  kind: :function,                   # or :module / :type / :callback
  signature: "to_string(number, options \\ [])",
  doc_first_line: "Format a number as a localized string.",
  group: "Numbers",
  package: :localize                  # or :calendrical / :localize_web
}

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the full list of indexed entries.

Rebuilds the index from scratch. Cheap — runs in under 100 ms on typical hardware.

Starts the index GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

entries()

@spec entries() :: [map()]

Returns the full list of indexed entries.

Reads from :persistent_term — O(1) heap copy of the list.

rebuild()

@spec rebuild() :: :ok

Rebuilds the index from scratch. Cheap — runs in under 100 ms on typical hardware.

start_link(options \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the index GenServer.