Skip to main content
Glama
draiqw
by draiqw

tg_search

Read-onlyIdempotent

Search across Telegram chats or within one chat. Filter by text, attachment kind, date, author, or tag; use local engine for morphology-aware results.

Instructions

Full-text search across all chats, or inside one chat when chat is given.

Two engines. "server" (default) asks Telegram: every chat, always current, but substring-only — morphology defeats it, the past-tense "dogovorilis" does not find "dogovorimsya". "local" searches the sqlite index built by tg_index: instant, ranked, morphology-aware, filterable by author, but only over the chats actually indexed. An empty local answer says what to index.

Args: query: text to look for. May be empty when filtering by kind, tag or (local only) author and period. A trailing "" on a word means prefix search in the local engine ("rent"). chat: restrict to one chat; omit to search everywhere. limit: how many messages to return. kind: attachment filter, same tabs as tg_media ("photo", "file", "music", "voice", "link", ...). Combine with an empty query to list, say, every document someone sent. since: ISO date — stop once messages get older than this. until: ISO date — start from this point back in time. tag: Saved Messages tag (chat="me" only), the same labels shown in Telegram. tg_saved_tags lists them. Server engine only. engine: "server" (Telegram) or "local" (the tg_index database). author: local engine only — whose messages, by name substring, or "me" for your own. brief: drop reactions, link cards and edit times. Same messages, about a quarter smaller — for triage, not for reading a chat closely.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagNo
chatNo
kindNo
briefNo
limitNo
queryNo
sinceNo
untilNo
authorNo
engineNoserver

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, and the description adds genuinely new behavioral context: the local index can be stale or partial ('only over the chats actually indexed'), an empty local answer itself signals what to index, and `brief` changes the payload shape. Nothing contradicts the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads purpose and the key engine decision before the argument list, and every line in the args section earns its place. The morphology example sentence is illustrative rather than filler, making an abstract weakness concrete.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter tool with no output schema, this is complete: engine constraints, parameter formats, cross-parameter interactions (empty query + kind, tag with chat='me'), and result-shape hints via `limit` and `brief` phrasing. The only micro-gap — the exact `chat` identifier format — is a family-wide convention established by siblings like tg_dialogs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description carries the full burden and documents all 10 parameters with semantics far beyond the bare schema: empty-query usage with kind/tag filters, trailing-'*' prefix behavior, engine-specific restrictions (tag is server-only, author is local-only), ISO date meaning, and `brief`'s payload effect.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource clause — 'Full-text search across all chats, or inside one chat when `chat` is given' — that precisely scopes the tool and distinguishes it from read-history siblings like tg_history and tg_mentions. The subsequent two-engine paragraph further disambiguates what kind of search is offered.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Dedicates a paragraph to engine selection with explicit trade-offs: 'server' reaches every chat and is always current but substring-only, while 'local' is morphology-aware and filterable but limited to indexed chats. The concrete morphology example ('dogovorilis' vs 'dogovorimsya') makes the failure mode tangible, and cross-references to tg_index and tg_saved_tags orient the agent within the tool family.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.