pub async fn run_tool_continue(
state: &Arc<ServerState>,
tracker: &Arc<ReadTracker>,
caps: &Arc<CapabilitySet>,
caller_id: Option<&str>,
tool_id: String,
cursor: String,
) -> ResponseExpand description
SP-pagination-v1 §4.4 — handle a Request::RunToolContinue.
Steps:
- Verify the cursor (HMAC + TTL + session nonce) →
CursorPayload. - Reject if the cursor’s
tool_id≠ request’stool_id(anti-replay). - Look up the tool; reject if not found, or if it doesn’t override
supports_pagination()(a cursor against a non-paginating tool is bug-or-attack territory; 1021). - Re-check
required_capabilitiesagainst the current connection’s capability set — caps may have changed since the cursor was issued (UCAN revocation, Hello re-negotiation). - Acquire the per-tool semaphore (same rate-limit envelope as
run_tool). - Build a
CallContextwith the cursor issuer attached. - Call
tool.call_paginated(Value::Null, &ctx, Some(&cursor_str)). Args are intentionallyNullon continuation — original args were fingerprinted into the cursor and the tool is expected to read its state fromcursor.opaque_state. - Emit one audit event tagged with
cursor_page= payload’s page_index. - Return
ToolResultResponsewith the newnext_cursorfrom the tool.