Excessibility.MCP.Progress (Excessibility v0.14.0)
View SourceHelper for sending MCP progress notifications.
Progress notifications allow tools to report their progress during long-running operations.
Usage
# In a tool's execute function:
def execute(args, opts) do
callback = Keyword.get(opts, :progress_callback)
if callback do
callback.("Starting...", 0)
# ... do work ...
callback.("Processing...", 50)
# ... more work ...
callback.("Complete", 100)
end
{:ok, result}
end
# When calling the tool with progress support:
callback = Progress.callback(token: "op-123")
Tool.execute(args, progress_callback: callback)
Summary
Functions
Creates a progress callback function.
Sends a progress notification to stdout.
Wraps a function with progress notifications.
Functions
Creates a progress callback function.
The returned function can be passed to tools via the :progress_callback option.
Options
:token- Progress token for correlating notifications (optional):io- IO device to write to (default: :stdio)
Example
callback = Progress.callback(token: "operation-123")
callback.("Processing...", 50)
Sends a progress notification to stdout.
This is used internally by the callback function.
Wraps a function with progress notifications.
Sends start (0%) and complete (100%) notifications automatically.
Example
result = Progress.with_progress(
"Running analysis",
token: "analysis-1",
fn ->
expensive_operation()
end
)