Skip to main content
Glama

Find a Telegram chat

telegram_find_chat
Read-onlyIdempotent

Find a person, group or channel by a partial name/title, @username, public Telegram link or numeric chat ID. Use chat_type to filter channels, groups or private chats. With Session, exact @usernames/public links resolve directly through Telegram; partial names search up to 1000 recent account dialogs, case-insensitively. Without Session, search is limited to this account's archive. A post link resolves its chat, not the specific post. After a direct name miss, the server tries bounded Cyrillic/Latin spellings and then distinctive name parts. Inspect match_stage and searched_queries; fallback results are candidates, not confirmed identities. Ask the user to select a candidate before reading personal history or choosing a recipient. Do not guess or transliterate exact @usernames/IDs. This does not join channels or perform global fuzzy search. Clarify ambiguous matches; use a known chat_id directly. If the requested channel cannot be read with the current connection, explain the actual limitation; do not require channel ownership or bot admin rights just for Session reading. Management of a channel you own or administer uses /channels separately. For human display names, extract the name from the request and use its base form (for example, Алексом -> Алекс). After a successful empty name lookup, before following any next_step suggestion to ask for an exact reference, inspect searched_queries across all previous calls and make at most 3 additional telegram_find_chat calls for this person or chat, only with distinct plausible spellings not already searched. Try a common Cyrillic/Latin spelling (for example, Алекс -> Alex when aleks was already searched), then an untried distinctive name part or plausible full/short name. Possible full/short names are candidates, not known aliases of the same person. Keep the requested chat_type and account scope. Stop retrying when candidates appear or the budget is exhausted; confirm the intended chat with the user before reading personal history or sending when it was found by changing the supplied name, even if requires_selection=false or only one candidate is returned. Never guess or alter exact @usernames, numeric IDs or public links. Do not use name retries after tool errors, timeouts or rate limits; respect retry delays. If no plausible untried variant remains, ask for an exact @username, chat ID or more precise name. An empty search alone does not prove disconnection. On no matches, explain only the observed search scope in the user's language; do not invent a cause or say the chat does not exist. After the bounded name retries still miss in Session, explain the 1000-dialog bound and try a known exact @username/public link; otherwise ask for one or a more precise name. For an exact-username miss, ask the user to check the username; do not treat it as a confirmed access denial. For an archive-only name miss, say no matching name was found in the saved archive; do not claim the chat is absent. After exhausting the bounded name retries, ask for an exact reference before suggesting setup. Only if a separate connection check confirms setup is needed, or the user requests another source, offer the relevant setup path, not every option: private conversations use Telegram Chat Automation, selecting @lemma_telepath_bot and the desired chats, then saving; send /setup to https://t.me/lemma_telepath_bot for device-specific steps. For a channel you own or administer, send /channels to that bot, choose Connect my channel and add it as administrator. For a group, an administrator can add @lemma_telepath_bot as a group administrator; the connected user must be a member. Do not request delete, ban or invite permissions just for reading. Bot API saves new messages received after setup; older history needs /import or reads through an already connected Session. Never ask for login codes/passwords in the assistant chat. Do not prescribe reconnection solely for an empty result or require setup for already usable archive content. If the tool errors, distinguish that from zero matches: explain the reported reason and an appropriate next step. Respect a returned retry delay; do not describe a timeout or temporary service failure as lost permissions. If the cause is unknown, say so and suggest retrying or support at https://t.me/hellolemma. Use an already connected Session where supported; preserve source, coverage and actual errors. Do not suggest connecting or reconnecting Session unless the user explicitly asks for Session setup. Never switch sender automatically or request login codes/passwords in chat.

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": {
      "query": "<query>"
    },
    "name": "telegram_find_chat"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoHow many candidates to return. Default 20; Session returns at most 50, archive search at most 100.
queryYesName/title only, using the base form of a person name rather than the full user sentence; or an unchanged exact @username, public t.me link, or numeric chat id.
chat_typeNoFilter by chat type. group includes basic groups and supergroups; channel means broadcast channels.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / query / description
      Previous value: -"Partial name/title, exact @username, public t.me link, or numeric chat id."New value: +"Name/title only, using the base form of a person name rather than the full user sentence; or an unchanged exact @username, public t.me link, or numeric chat id."
  2. Changed1 schema field changed
    • changedInput schema / properties / limit / description
      Previous value: -"How many candidates to return. Default 20."New value: +"How many candidates to return. Default 20; Session returns at most 50, archive search at most 100."
  3. Changed2 schema fields changed
    • addedInput schema / properties / chat_type
      Added value: +{
      +  "description": "Filter by chat type. group includes basic groups and supergroups; channel means broadcast channels.",
      +  "enum": [
      +    "private",
      +    "group",
      +    "supergroup",
      +    "channel",
      +    "channel_dm"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / query / description
      Previous value: -"Name, @username, or numeric chat id."New value: +"Partial name/title, exact @username, public t.me link, or numeric chat id."
  4. First observed

TDQS

A4/5.0
Behavior5/5

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

Annotations only declare read-only/idempotent/open-world; the description adds substantial behavior beyond them: the 1000-dialog search bound, case-insensitive partial matching, bounded Cyrillic/Latin and name-part fallbacks, match_stage/searched_queries as the signal that results are unconfirmed candidates, post links resolving the chat rather than the post, and a hard retry budget of 3 distinct spellings. It also warns that empty results do not prove disconnection, which a caller could not infer from readOnlyHint alone.

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

Conciseness2/5

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

The purpose and matching behavior sit in the first two sentences, but the remainder is a wall of repeated policy (the retry rule is restated three times, "never ask for login codes/passwords in chat" appears twice verbatim) interleaved with setup instructions for /setup, /channels, and bot admin permissions. Much of this is agent operating doctrine rather than tool definition, so significant parts do not earn their place.

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

Completeness4/5

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

For a 3-parameter, no-output-schema lookup tool, the definition covers all decision-relevant behavior: scope, fallback ladder, candidate ambiguity handling, and error-versus-no-match distinction. It is arguably over-complete in the setup/credential domain, which dilutes the signal an agent needs at call time rather than filling a gap.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description earns above baseline by explaining matching semantics per input form: partial names are case-insensitive and limited to recent dialogs, exact @usernames/IDs/links must not be transliterated or altered, and names should be reduced to base form (Алексом -> Алекс). It says little about limit beyond the schema's own wording, and chat_type is largely covered by the enum description.

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

Purpose4/5

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

The opening sentence gives a specific verb and resource plus the accepted input forms (partial name/title, @username, public t.me link, numeric chat ID), and later sentences bound scope ("does not join channels or perform global fuzzy search", "use a known chat_id directly"). It is clearly distinguishable from sibling readers like telegram_list_chats or telegram_search_messages, though no sibling is named explicitly and the core statement is buried under 500 words of policy text.

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

Usage Guidelines4/5

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

It states when the tool works well (exact @usernames/links resolve directly with Session) versus its degradation modes (archive-only search without Session) and explicitly excludes out-of-scope actions (joining channels, global fuzzy search, channel management via /channels). What is missing is routing against the actual sibling set — an agent gets no signal about when to prefer telegram_list_chats or telegram_search_messages over this tool.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources