pub async fn batch_fetch(
refs: &[Ref],
profile: &CapabilityProfile,
ctx: &FetchContext,
store: &dyn Store,
store_root: &Utf8Path,
) -> Result<BatchOutcome, FetchError>Expand description
Iterate over refs through fetch_paper, collecting one
BatchResultEntry per ref.
Cap: caller must supply at most MAX_BATCH_REFS refs; otherwise
the function returns Err(FetchError::TooManyRefs { got, max })
before any fetch is attempted. The cap mirrors the CLI’s
commands::batch enforcement (MCP_BATCH_MAX_SIZE).
Concurrency: Slice 2 dispatches refs serially through
fetch_paper. The CLI’s existing commands::batch::run_with_options
keeps its bounded-concurrency JoinSet+semaphore path for backward
compatibility; the MCP server uses this serial loop because the MCP
tool boundary already serializes calls per session.
Session bookkeeping: this function does NOT emit SessionStart
/ SessionEnd rows — that is the caller’s responsibility.