read
Fetch document content by ID from Linkly AI with line-based pagination to inspect specific sections, referenced images, and user annotations.
Instructions
[Workflow: search → grep or outline → read] Read content of a document by its ID. Supports line-based pagination: use offset to start from a specific line number and limit to control how many lines to read. Returns content with line numbers. Results include a "Referenced images in shown range" mapping that resolves markdown image refs to indexed image documents (doc_id + text excerpt); control detail with the optional image_text parameter ("none" / "abstract" / "full"). For image documents, pass include_image=true to receive the image itself as an image content block (resized, about 1,600 tokens); the text result always says whether an image is available. Images inside a scanned PDF appear as [Image p3-1]; pass image="p3-1" to see one (one image per call). For long documents, prefer using outline or grep first to identify target sections, then read specific ranges.
Size fields (Desktop-local documents): word_count counts words (one per CJK character or Latin word; whitespace/punctuation/markup excluded) and reads well below a Chinese user's 字数; char_count counts Unicode characters of the extracted body (whitespace/punctuation/markup included, CR excluded) — the figure to match what the user sees. null/omitted char_count = not yet computed (or an older Desktop), not an empty body; read on a local document returns it whenever the Desktop supports it. cloud:// items do not carry char_count. Characters covers the whole available body, not just the returned lines, and is partial while OCR/ASR is pending or extraction was truncated.
For a Markdown clip that carries user annotations (highlights, notes and comments written in the clip reader), a "User annotations" block follows the content on the first content page (offset=1) or whenever annotations_offset is given; annotations page independently of the lines (20 per call, 20000-character budget) and the block reports total, has_more and next_annotations_offset. Pass limit=1 with annotations_offset to page annotations only.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc_id": "<doc_id>"
},
"name": "read"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | No | ID of an image inside this document, as shown in its placeholders such as [Image p3-1] (page 3, first image). Returns only that image (resized, metadata stripped) and any text printed in it; offset and limit are ignored. Local documents only. null = omitted. | |
| limit | No | Number of lines to read (default: 200, max: 500) | |
| doc_id | Yes | Document ID (obtained from search results). Opaque string — pass through verbatim from `search`. Local documents take the form `local://<integer>`; bare integer IDs from older clients remain accepted. | |
| offset | No | Starting line number (1-based, default: 1) | |
| image_text | No | Detail level for the referenced-images mapping appended to the result (markdown image refs found within the shown line range are resolved to indexed image documents): "none" = mapping only (line, file, doc_id); "abstract" (default) = plus one-line text excerpt and word count per image; "full" = plus inline OCR text (per-image 2000-char cap, 20000-char total budget; over-budget images degrade to abstract with a pointer to read them individually). Omitting or null yields "abstract". | |
| include_image | No | Return the image itself as an MCP image content block in addition to the text. Only applies to image documents (png / jpeg / bmp / webp); defaults to false. The image is resized (long edge at most 1568 px, about 1.15 megapixels), re-encoded and stripped of metadata before it is returned, and is attached only on the first page (offset=1). Requires a client that accepts image results. Omitting or null means false. | |
| output_format | No | Output format. Defaults to "markdown" (human-readable); set to "json" for structured JSON (machine-parseable). Sending `null` or omitting the field both yield the default. | |
| annotations_offset | No | Offset into the document's user annotations (highlights, notes and comments written in the clip reader, stored next to the Markdown as `<stem>.annotations.json`), 0-based, default 0. Annotations are paged independently of the content lines: a "User annotations" block is appended after the content when `offset` is 1 (the first content page) or when this field is given explicitly, at most 20 annotations per call within a 20000-character budget; the block reports `total`, `has_more` and `next_annotations_offset`. To page through annotations only, pass `limit=1` to keep the content block minimal. Sending `null` or omitting the field both yield 0. |