Ectomancer.RouteIntrospection (Ectomancer v1.2.1)

Copy Markdown View Source

Phoenix route introspection for Ectomancer.

This module requires Plug to be available at runtime for route execution.

Summary

Functions

Builds a tool name from a route.

Exposes Phoenix routes as MCP tools.

Filters routes based on options.

Extracts routes from a Phoenix router module.

Parses a Phoenix route path and extracts parameters.

Functions

build_tool_name(route)

@spec build_tool_name({String.t(), String.t(), module(), atom()}) :: atom()

Builds a tool name from a route.

build_tool_name(arg, namespace)

@spec build_tool_name({String.t(), String.t(), module(), atom()}, atom() | nil) ::
  atom()

expose_routes(router_module, opts \\ [])

(macro)

Exposes Phoenix routes as MCP tools.

filter_routes(routes, opts)

@spec filter_routes(
  [{String.t(), String.t(), module(), atom()}],
  keyword()
) :: [{String.t(), String.t(), module(), atom()}]

Filters routes based on options.

get_routes(router_module)

@spec get_routes(module()) :: [{String.t(), String.t(), module(), atom()}]

Extracts routes from a Phoenix router module.

parse_path_params(path)

@spec parse_path_params(String.t()) :: {String.t(), [{atom(), :param | :glob}]}

Parses a Phoenix route path and extracts parameters.