Phantom.Cache (phantom_mcp v0.3.2)

View Source

Storage for tooling specifications. The backend is :persistent_term.

You typically won't need to interact with Phantom.Cache directly, but if you're registering new tooling within the runtime, then you may want to use the functions herein.

Summary

Functions

Add an MCP Prompt for the given router.

Add an MCP Resource Template for the given router.

Add an MCP Tool for the given router.

List all the entities for the given type.

Initialize the cache with compiled tooling for the given router.

Functions

add_prompt(router, prompt_spec)

Add an MCP Prompt for the given router.

add_resource_template(router, resource_template_spec)

(macro)

Add an MCP Resource Template for the given router.

This will also purge and generate a ResourceRouter module for each scheme provided.

add_tool(router, tool_spec)

Add an MCP Tool for the given router.

list(session, module, type)

@spec list(Session.t() | nil, module(), :tools | :prompts | :resource_templates) :: [
  Phantom.Tool.t() | Phantom.Prompt.t() | Phantom.ResourceTemplate.t()
]

List all the entities for the given type.

register(router)

Initialize the cache with compiled tooling for the given router.

You likely don't need to call this yourself, as Phantom.Plug will call it if needed.