Skip to content
Book a demo

Tools

read_document

read_documentRead within a Nylon legal-library document

  • Read-only
  • Non-destructive
  • Closed world

Reads within one document from Nylon’s library: the whole document, the passages that best match a phrase, or the passages either side of a known extract. Use it after a search to check exact wording or read further. Every extract links back to the source in Nylon.

Description sent to the assistant

Read WITHIN a single document from the Nylon legal library, or read passages around a known extract. Use this after search_library has identified a relevant document (by documentId) or extract (by chunkId).

Three modes, chosen by the field combination:

  • Whole document: pass only documentId. Returns the whole document, capped at ~50,000 tokens. If it is longer, only the first portion is returned — use search-within for the rest.
  • Search within: documentId + a "phrase". Returns the most relevant extracts inside that document. Pick searchType="keyword" for exact strings/citations or "semantic" (default) when you are unsure of the wording.
  • Adjacent: documentId + an "extractId" (chunkId). Returns the extracts immediately above and/or below that chunk — useful for reading the context around a passage or continuing past a cut-off. Choose direction via position (defaults to both).

Returns extracts with their text, identifiers (chunkId / documentId), and a clickable resolver link.

When citing a source, use ONLY the `link` field from the result. Never construct, guess, or recall a source URL yourself — in particular do not link to austlii.edu.au, nzlii.org, or other external case-law databases. If a result has no link, cite it by title without a URL.

NameTypeDescription
documentId
Required
stringThe documentId (UUID) from a search_library result — the document to read. (format uuid)
extractIdstringAdjacent mode: a chunkId from a prior result — returns the passages around that extract. Must belong to the document in documentId. Mutually exclusive with phrase. (format uuid)
phrasestringSearch-within mode: the text to find inside this document. Keyword queries support AND, OR, parentheses, and "quoted phrases". Mutually exclusive with extractId; omit both to read the whole document. (min length 1, max length 400)
position"above" | "below" | "both"Adjacent mode only (requires extractId). Which passages to read relative to the extract. Defaults to "both".
searchType"semantic" | "keyword"Search-within mode only (requires phrase). "keyword" for precise string lookups; "semantic" (default) for embedding-based relevance.

The fields you pass choose the mode:

Mode Pass Returns
Whole document documentId only The document, up to about 50,000 tokens. Longer documents are truncated; use search-within for the rest.
Search within documentId + phrase (+ optional searchType) The most relevant extracts inside the document. semantic is the default; use keyword for exact strings and citations.
Adjacent documentId + extractId (+ optional position) The extracts immediately above, below or on both sides of a known chunk. Useful for context or to continue past a cut-off.

phrase and extractId can’t be combined. Passing both returns Read failed. with an explanation.

One text block:

  • a count and the mode, such as 2 extracts (portion):;
  • numbered rows, each with the document title, facets (type, contentType, jurisdiction, subJurisdiction, practiceAreas, date, order, page, score), the extract, a link, and the documentId and chunkId;
  • any warnings.

An empty read returns No content returned for this read., followed by any warnings.

Arguments
{
"documentId": "9b2e…",
"phrase": "taxable supplies exceed $60,000",
"searchType": "keyword"
}
Result (abridged)
2 extracts (portion):
1. Goods and Services Tax Act 1985
contentType: legislation | jurisdiction: nz | practiceAreas: tax | order: 412 | score: 0.91
…
link: https://docs.usenylon.com/d/4f0c…
documentId: 9b2e… | chunkId: 4f0c…
2. …

Assistants call read_document after search_library has found a relevant document or extract. They use it to check the exact wording of a provision, read the reasoning in a judgment, or follow a passage that a search extract cut short.

Prompts that lead to a read:

  • “Quote the exact wording of the section you’re relying on.”
  • “Read the rest of that judgment’s reasoning on the second issue.”
  • “What does the next subsection say?”
Full JSON schema
tools/list entry
{
"name": "read_document",
"title": "Read within a Nylon legal-library document",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"documentId": {
"description": "The documentId (UUID) from a search_library result — the document to read.",
"format": "uuid",
"type": "string"
},
"extractId": {
"description": "Adjacent mode: a chunkId from a prior result — returns the passages around that extract. Must belong to the document in documentId. Mutually exclusive with phrase.",
"format": "uuid",
"type": "string"
},
"phrase": {
"description": "Search-within mode: the text to find inside this document. Keyword queries support AND, OR, parentheses, and \"quoted phrases\". Mutually exclusive with extractId; omit both to read the whole document.",
"maxLength": 400,
"minLength": 1,
"type": "string"
},
"position": {
"description": "Adjacent mode only (requires extractId). Which passages to read relative to the extract. Defaults to \"both\".",
"enum": [
"above",
"below",
"both"
],
"type": "string"
},
"searchType": {
"description": "Search-within mode only (requires phrase). \"keyword\" for precise string lookups; \"semantic\" (default) for embedding-based relevance.",
"enum": [
"semantic",
"keyword"
],
"type": "string"
}
},
"required": [
"documentId"
],
"type": "object"
},
"annotations": {
"destructiveHint": false,
"openWorldHint": false,
"readOnlyHint": true,
"title": "Read within a Nylon legal-library document"
}
}