unlob Docs
Browse documentation

assemble_context: a ready-to-read context pack

Get a ready-to-read context pack for a question, instead of a link list.

Behaviour

Returns the corroborated, story-deduped, trust-ranked passages for a question, packed to a token budget, each carrying the reason it was included.

The engine runs the whole retrieval loop — search, dedup, corroborate, rank, pack — so you just read. Use this when the question is 'what should I know about X' rather than 'find me the page that says Y'.

`budget` is in tokens and is honoured as a ceiling; `estimated_tokens` reports what was actually packed.

Costs 3 credits; a call that runs and fails costs 1.

Arguments

inputSchema

NameTypeDescription
budgetintegerToken budget for the pack
mode"keyword" | "semantic" | "hybrid"—
qrequiredstringThe question

Returns

A JSON payload in the text content block, and the same payload as structuredContent for clients that support it.

outputSchema

NameType
estimated_tokensrequiredinteger
itemsrequiredobject[]
queryrequiredstring
token_budgetrequiredinteger

Calling it

Over Streamable HTTP, with the required arguments filled in:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "assemble_context",
    "arguments": {
      "q": "<q>"
    }
  }
}

Most clients do this for you — see Connect a client. To drive it by hand, complete the startup lifecycle first.

The same call over REST

If your client does not speak MCP, this capability is GET /assemble_context, taking the same parameters and returning the same body.

curl -H "x-api-key: $UNLOB_API_KEY" \
  "https://api.unlob.com/assemble_context?q=<q>"