Skip to main content
context.fetch returns a ranked, token-budgeted bundle. That is the right tool for most questions. It is the wrong one for “list every contract with Acme that expires before March”, where a ranked top few hides what it left out, and for “check what section 4 of that contract says”, where the agent needs the document itself. Four more calls cover those two needs.
These calls are enabled per instance and need a Pro plan or above. Where a call is not enabled for your instance it raises ContextNotFoundError, the same error as for a document that does not exist, and the matching MCP tool is not listed. A plan without the feature raises FeatureNotInPlanError. Each successful call uses credits. They are in Python 0.9.0 and later and JavaScript 0.9.0 and later.

Which call to use

Orient, then query

You send a structured request, never question text; the agent turns the question into target, where and related using what describe returned. Every answer carries:
  • total and complete. total is every match, not only this page; page on with next_cursor. complete: False means the set was larger than a query returns, so the matches you can page through are not all of them: narrow the query with a filter before the agent states a number.
  • coverage. How many documents in scope could hold matches but are not processed yet (unprocessed), were only lightly read (light_only), or failed. An agent can then report “14 found; 3 contracts still processing” rather than claim a full answer. A query is complete over what Synap has extracted, and coverage says what that leaves out.
An aggregate is a count or counts grouped by a property: aggregate={"count": True} or aggregate={"group_by": "status"} (aggregate: { count: true } or aggregate: { group_by: 'status' } in TypeScript).

Open a document, then read

index takes a version to open an older version’s outline. read always reads the current version and returns a bounded amount of text per call (at most 20 pages); a larger request raises InvalidInputError, so the agent should ask for a smaller section or range. While a document is still being processed, read raises ContextNotFoundError with code == "document_not_ready" (serverCode in TypeScript) and index returns an empty section list; try again shortly. A page range with no text, such as one past the last page, raises InvalidInputError and is not charged. While part of a document has been removed by a forget request, index returns no document-level summary. Pass the same user_id, customer_id and scope you read the document at with context.fetch, also when you hold a document_key. A document you cannot see, whether it is another customer’s, another user’s, outside your instance’s visibility, or deleted, raises ContextNotFoundError, the same as one that does not exist.

MCP tools

On deployments where document and knowledge features are enabled, the Synap MCP server adds four tools beside its memory tools: synap_describe, synap_query, synap_document_index and synap_document_read. They match the SDK calls above. Their descriptions tell the agent to call synap_describe first and to report coverage. recall_context stays the search tool. A tool call that Synap refuses because the feature is off for the instance, or because the document is not visible, comes back as an ERROR: message the agent can act on.