Tools Overview
Linkly AI exposes four tools to AI assistants via MCP (Model Context Protocol), forming a progressive document access workflow:search
Search documents and find relevant results
outline
View document outlines to understand structure
grep
Find specific text patterns with regex matching
read
Read document content for detailed information
Search
Searches indexed local documents and returns a list of the most relevant results.Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | Yes | — | Search keywords or phrase |
limit | number | No | 20 | Maximum number of results (1-50) |
doc_types | string[] | No | All | Filter by document type, e.g. ["pdf", "md", "docx"] |
output_format | string | No | markdown | Set to json for structured JSON output |
Response Fields
Each search result contains the following information:| Field | Description |
|---|---|
doc_id | Unique document identifier for subsequent outline/read calls |
title | Document title |
path | File path |
relevance | Relevance score (0-1) |
word_count | Document word count |
total_lines | Total number of lines in the document |
has_outline | Whether an outline is available |
modified_at | Last modified time |
keywords | Extracted keyword list |
snippet | Matching content snippet |
Usage Examples
Outline
Retrieves the structured outline and metadata of one or more documents, helping to quickly understand document structure and locate target sections.Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
doc_ids | string[] | Yes | — | List of document IDs (from search results) |
expand | string[] | No | Auto | Node IDs to expand (e.g. ["2", "3.1"]); omit to automatically show all levels |
output_format | string | No | markdown | Set to json for structured JSON output |
When to Use Outline
| Scenario | Recommendation |
|---|---|
| Document > 50 lines with outline | View outline first, then read target sections |
| Short document (< 50 lines) | Skip outline, read full text directly |
Document with has_outline: false | Use grep to find patterns or read page by page |
The outline feature works best with bookmarked PDFs, Markdown, and
DOCX documents. It is especially effective when reading lengthy documents
and books. Outline support for plain text and unbookmarked PDFs will be added
in future iterations.
Usage Examples
Grep
Locate specific lines within a single document by regex pattern. Best for documents withhas_outline=false where outline is unavailable. Use after search to pinpoint exact positions of names, dates, terms, identifiers, or any pattern — then use read with offset to see full context. Works on all document types (PDF, Markdown, DOCX, TXT, HTML). For searching across multiple documents, call grep once per document.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
pattern | string | Yes | — | Regular expression pattern to search for |
doc_id | string | Yes | — | Document ID to search within (from search results) |
context | number | No | 3 | Lines of context before and after each match |
before | number | No | — | Lines of context before each match (overrides context) |
after | number | No | — | Lines of context after each match (overrides context) |
case_insensitive | boolean | No | false | Case-insensitive matching |
output_mode | string | No | content | content (matching lines with context) or count (match count only, preview totals first) |
limit | number | No | 20 | Maximum matching lines to return (max 100) |
offset | number | No | 0 | Number of matches to skip for pagination |
output_format | string | No | markdown | Set to json for structured JSON output |
When to Use Grep vs Outline
| Scenario | Recommendation |
|---|---|
| Need to find a specific term, name, or date | Use grep with the pattern |
| Need to understand overall document structure | Use outline |
Document has no outline (has_outline: false) | Use grep to locate content |
| Looking for patterns (emails, IDs, numbers, etc.) | Use grep with regex |
Usage Examples
Read
Reads document content with line number positioning and pagination, suitable for reading specific parts of long documents. The Read tool behaves consistently with the Claude AI SDK, ensuring optimal results across various Agentic AI models.Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
doc_id | string | Yes | — | Document ID (from search results) |
offset | number | No | 1 | Starting line number (from 1) |
limit | number | No | 200 | Number of lines to read (max 500) |
output_format | string | No | markdown | Set to json for structured JSON output |
Content Format
TheRead tool returns content with line numbers for easy reference and positioning:
Pagination Strategy
For long documents, it is recommended to read in chunks:read to precisely retrieve the content within that range.
Usage Examples
Workflow Examples
Complete Workflow: CLI Method
The following example demonstrates how to perform a complete document retrieval via CLI:Complete Workflow: MCP Method
When AI assistants call tools via the MCP protocol, the request format is as follows:FAQ
What document formats are supported?
What document formats are supported?
Linkly AI currently supports the following formats:
| Format | Extensions | Outline Support |
|---|---|---|
| Markdown | .md, .mdx | Yes |
| Word | .docx | Yes |
.pdf | Partial | |
| Plain Text | .txt | No |
| HTML | .html, .htm | Partial |
What if an outline is not available?
What if an outline is not available?
If a document has no available outline (
has_outline: false), you can:- Use the
readtool directly to browse the document content page by page - Read the beginning of the document first (default 200 lines) to get a general idea, then decide whether to continue reading
How to handle long documents?
How to handle long documents?
Recommended workflow:
- First use
outlineto understand the document structure (if an outline is available) - Based on the line ranges in the outline, use the
offsetandlimitparameters ofreadto precisely read target sections - Read up to 500 lines at a time, and paginate by adjusting
offset
What is the default port for the MCP service?
What is the default port for the MCP service?
The default port is 60606. If that port is occupied, the application will automatically try other ports. You can check the actual port in use in Linkly AI Desktop’s settings.
What if search results are inaccurate?
What if search results are inaccurate?
You can try:
- Using more precise keywords
- Using natural language descriptions (leveraging vector semantic matching)
- Mixing keywords and synonyms, e.g.
"authentication auth login sign-in" - Using
--typeto filter specific document types and narrow the search scope

