MCP search navigation: TOC, match_id и note_html
Дата: 2026-05-03 13:26 UTC
Главный вывод
В текущей проверке TOC-навигация через toc_path не заработала как описано в en/user/mcp.md.
Фактически на dobireports.2pub.me/_system/mcp сейчас работает другой, более полезный механизм:
search(query) → result with match_id → note_html(pid/path, match_id) → focused chunk window
То есть вместо секционной навигации по toc_path агент может экономить токены через match_id.
На trip2g.com/_system/mcp ситуация отличается: сервер отдаёт более старую/простую схему tools, где note_html принимает только path, а search возвращает текстовый список без match_id/toc.
Что проверялось
Проверялись два MCP endpoint:
https://trip2g.com/_system/mcp
https://dobireports.2pub.me/_system/mcp
Методы:
tools/list
tools/call search
tools/call note_html
Проверялись варианты:
{"path":"en/user/default-template.md"}
{"path":"en/user/default-template.md","toc_path":["What the default template includes"]}
{"path":"en/user/default-template.md","toc_path":["Content blocks"]}
{"pid":530,"toc_path":["Methods"]}
{"path":"en/user/mcp.md","toc_path":["Methods"]}
И для dobireports:
{"path":"Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md"}
{"path":"Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md","match_id":"p29:c32"}
{"pid":29,"match_id":"p29:c32"}
{"path":"Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md","toc_path":["MCP properties для `AGENTS.md`, `SCHEMA.md` и дополнительных инструкций"]}
Что говорит документация
В en/user/mcp.md описано:
searchвозвращаетtoc— table of contents;matches[]содержитtoc_path— путь до секции, где найден match;note_htmlпринимаетtoc_pathи может вернуть только одну секцию;- это должно экономить токены для длинных заметок.
Описанный workflow:
search(query)
→ read result.toc and matches[].toc_path
→ note_html(pid/path, toc_path=match.toc_path)
→ load only relevant section
Что фактически найдено на trip2g.com/_system/mcp
tools/list
tools/list вернул:
{
"name": "search",
"description": "Search notes by query (hybrid: text + semantic)",
"inputSchema": {"query": "string"}
}
{
"name": "note_html",
"description": "Get HTML content of a note by path",
"inputSchema": {
"properties": {
"path": {"type":"string"}
},
"required": ["path"]
}
}
Вывод:
- в публичном MCP
trip2g.comschema дляnote_htmlне объявляетtoc_path; pidтоже не объявлен;searchвозвращает plain text список результатов;- structured
toc/matches[].toc_pathнаружу не видны.
Попытка вызвать note_html с toc_path
Запрос:
{
"path": "en/user/default-template.md",
"toc_path": ["What the default template includes"]
}
Результат:
- HTTP 200;
- вернулся полный HTML заметки;
- размер ответа совпал с обычным
note_html(path); toc_pathфактически проигнорирован.
Запрос:
{
"pid": 530,
"toc_path": ["Methods"]
}
Результат:
{"error":{"code":-32602,"message":"path is required"}}
Вывод:
На trip2g.com/_system/mcp `toc_path` сейчас не работает как public tool contract, несмотря на текст в docs.
Что фактически найдено на dobireports.2pub.me/_system/mcp
Тут tools выглядят новее и полезнее.
tools/list
search:
Search notes by query and return note ids, snippets, and match ids. After search, open the best result with note_html(pid=..., match_id=...) when a match id is available.
note_html:
Read a note by pid, note_id, href, or path. If search returned match_id, pass it here to fetch a focused chunk window and save tokens.
Input schema для note_html содержит:
{
"context_words": "number",
"href": "string",
"match_id": "string",
"note_id": "number",
"path": "string",
"pid": "number"
}
Вывод:
На dobireports актуальный механизм — не toc_path, а match_id-focused reads.
search возвращает match_id
Пример результата поиска:
1. 20 - ТЗ для агента - LLM Wiki страница для trip2g.com
Исследование trip2g/20 - ТЗ для агента - LLM Wiki страница для trip2g.com.md
https://dobireports.2pub.me/...
… mcp_method: schema ...
match_id: p31:c12
Другой результат:
2. 18 - Инструкция для внешнего агента - первый бесплатный инстанс
Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md
https://dobireports.2pub.me/...
… mcp_method: schema ...
match_id: p29:c32
note_html(path, match_id) работает
Полный вызов:
{
"path": "Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md"
}
Вернул полный HTML заметки:
len ≈ 38236 chars
Focused вызов:
{
"path": "Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md",
"match_id": "p29:c32"
}
Вернул короткое окно вокруг match:
len ≈ 1283 chars
Внутри был именно нужный участок:
### `SCHEMA.md` как MCP method
`SCHEMA.md` действительно хороший кандидат на отдельный `mcp_method`...
Также сработало:
{
"pid": 29,
"match_id": "p29:c32"
}
note_html(path, toc_path) на dobireports не сработал как секционная навигация
Запрос:
{
"path":"Исследование trip2g/18 - Инструкция для внешнего агента - первый бесплатный инстанс.md",
"toc_path":["MCP properties для `AGENTS.md`, `SCHEMA.md` и дополнительных инструкций"]
}
Результат:
- вернулся полный HTML заметки;
toc_pathбыл проигнорирован;- в
tools/listtoc_pathне объявлен.
Вывод по product/API contract
Сейчас есть рассинхрон между docs и реальным MCP contract:
Docs говорят
search returns toc + matches[].toc_path
note_html accepts toc_path
trip2g.com MCP фактически
search returns plain text list
note_html accepts only path
dobireports MCP фактически
search returns plain text list with match_id
note_html accepts path/pid/note_id/href + match_id
match_id returns focused chunk window
Рекомендация для документации
Переписать раздел MCP navigation так, чтобы он описывал два возможных механизма, или выбрать один canonical.
Если canonical сейчас match_id, то docs должны говорить:
## Token-saving navigation with match_id
1. Call `search(query)`.
2. Pick a result with `match_id`.
3. Call `note_html(pid=..., match_id=...)` or `note_html(path=..., match_id=...)`.
4. Use the focused chunk for initial reasoning.
5. If you need the whole note, call `note_html(pid=...)` without `match_id`.
Пример:
{
"name": "note_html",
"arguments": {
"pid": 29,
"match_id": "p29:c32"
}
}
И отдельно:
## Section navigation with toc_path
Status: planned / experimental / only available on some deployments.
If `tools/list` for your MCP server includes `toc_path`, you can pass a TOC breadcrumb to `note_html`.
If not, use `match_id` from search results.
Рекомендация для implementation
Нужно решить, какой contract является целевым:
Вариант A — оставить match_id как основной
Плюсы:
- уже работает на
dobireports; - хорошо экономит токены;
- проще для агента: search → match_id → focused read;
- не требует точного совпадения заголовков.
Минусы:
- это chunk-window, а не semantic section;
- для длинной структурной документации иногда нужна вся секция, не только match context.
Вариант B — доделать toc_path
Плюсы:
- лучше для документации;
- позволяет агенту навигировать по структуре;
- хорошо сочетается с LLM Wiki/index-first mode.
Минусы:
- нужно добавить в реальный
tools/listschema; - нужно сделать
searchstructured или хотя бы текстово выводить TOC/toc_path; - нужно реализовать/починить фильтрацию
note_html(..., toc_path=...).
Вариант C — поддерживать оба
Лучший продуктовый вариант:
match_id — for search hit focused windows
toc_path — for deliberate section navigation
Тогда recommended agent workflow:
1. search(query)
2. If result has match_id → note_html(pid/path, match_id)
3. If more context needed → full note_html(pid/path)
4. If TOC is available → navigate by toc_path to nearby sections
5. Answer with citations
Что добавить в TASKS
Добавить новую задачу:
TASK — Align MCP docs and implementation for note navigation
Priority: P1
Owner: external-agent / author
Artifact: docs patch + implementation check
Acceptance:
- tools/list accurately documents note_html args;
- docs mention match_id if it is canonical;
- docs do not promise toc_path unless it works;
- trip2g.com and user instances expose consistent MCP schema or docs explain version difference;
- test case: search → match_id → note_html focused window.
Практическая инструкция для агента прямо сейчас
До исправления docs агентам лучше давать такую инструкцию:
When using Trip2G MCP:
1. Call tools/list first.
2. Inspect note_html inputSchema.
3. If search results contain match_id, use note_html(pid/path, match_id) for focused reads.
4. If note_html supports toc_path, use toc_path for section reads.
5. If neither is supported, use note_html(path) and read the full note.
6. Do not assume toc_path works just because docs mention it.
Статус проверки
trip2g.com/_system/mcp: tested,toc_pathnot exposed/ignored;pathrequired.dobireports.2pub.me/_system/mcp: tested,match_idworks;toc_pathnot exposed/ignored.- Native Hermes MCP wrapper: exposes simplified tools; for detailed API contract use direct JSON-RPC or inspect
tools/list.