Phantom.Tracker (phantom_mcp v0.3.2)

View Source

Track open streams so that notifications and requests can be sent to clients.

Add to your supervision tree:

{Phoenix.PubSub, name: MyApp.PubSub},
{Phantom.Tracker, [name: Phantom.Tracker, pubsub_server: MyApp.PubSub]},

For example, a request may need to elicit more input from the client, so the first request stream will remain open, and the notification stream will send and new request to the client, and the client will POST its response. The new response connection will notify the first request connection with the result and the tool can continue with the elicited information.

See Phantom section for more information.

Summary

Functions

Returns a specification to start this module under a supervisor.

Fetch the PID of the open request by ID

Fetch the PID of the open session by ID

Return a list of all open requests

Return a list of all listening for resources

Return a list of all open sessions

Notify any listening MCP sessions that the list of prompts has updated

Notify any listening MCP sessions that the list of prompts has updated

Notify any listening MCP sessions that the resource has updated

Notify any listening MCP sessions that the list of tools has updated

Subscribe the process to resource notifications from the PubSub on topic "phantom:resources"

Unsubscribe the process to resource notifications from the PubSub on topic "phantom:resources"

Untrack the processe for everything

Untrack any processes for the request

Untrack any processes for the session

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_request(request_id)

Fetch the PID of the open request by ID

get_session(session_id)

Fetch the PID of the open session by ID

list_requests()

Return a list of all open requests

list_resource_listeners()

Return a list of all listening for resources

list_sessions()

Return a list of all open sessions

notify_prompt_list()

Notify any listening MCP sessions that the list of prompts has updated

notify_resource_list()

Notify any listening MCP sessions that the list of prompts has updated

notify_resource_updated(uri)

Notify any listening MCP sessions that the resource has updated

notify_tool_list()

Notify any listening MCP sessions that the list of tools has updated

requests_topic()

resource_subscription_topic()

sessions_topic()

subscribe_resource(uri)

Subscribe the process to resource notifications from the PubSub on topic "phantom:resources"

track_request(pid, request_id, meta \\ %{})

Track a request PID

track_session(pid, session_id, meta \\ %{})

Track a session PID

unsubscribe_resource(uri)

Unsubscribe the process to resource notifications from the PubSub on topic "phantom:resources"

untrack(pid)

Untrack the processe for everything

untrack_request(request_id)

Untrack any processes for the request

untrack_session(session_id)

Untrack any processes for the session