Skip to main content
Glama

List files

tg_list_files
Read-only

List files in a Telegram chat by type, date, extension, name, or size and return metadata, counts, and total size; paginate with an offset for large results.

Instructions

List files in a chat (metadata only: name, size, kind, date, link) with filters, plus count and total size. Scans up to 5000 messages per call; continue with next_offset_id. Files seen are also saved to the local index. For a complete list of a big chat use tg_index_chat or tg_export.

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": {
      "chat": "<chat>"
    },
    "name": "tg_list_files"
  }
}

Input Schema

NameRequiredDescriptionDefault
chatYesChat: @username, username, t.me link, t.me/c/<id> link, or numeric id such as -100123…
limitNo
sinceNoStart date, ISO (e.g. 2025-01-01).
typesNoFile kinds. Default: everything except stickers.
untilNoEnd date, ISO.
fieldsNoKeep only these fields in list items (e.g. ["message_id","name","size"])
formatNocompact = lists as {columns, rows} tables; saves a lot of context for long listingsjson
accountNoAccount id (see tg_list_accounts). Defaults to the default account.
offset_idNo
extensionsNoExtensions, e.g. ["zip", "mp4"].
scan_limitNoMax messages to scan
max_size_mbNo
min_size_mbNo
oldest_firstNo
name_containsNoFile name or caption contains (case-insensitive).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only declare a safe read (readOnly/openWorld/non-destructive); the description adds real behavioral context beyond them: metadata only with no file content, a 5000-message scan ceiling per call, pagination via next_offset_id, and the non-obvious side effect that files seen get written to the local index. That side-effect disclosure is exactly the kind of information annotations cannot carry.

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?

Three short sentences, front-loaded with the purpose and return shape, then pagination limits, then the routing alternative. No filler, and each clause carries information an agent needs to plan the call.

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 15-parameter tool with no output schema, the description still conveys the result shape (per-file metadata plus count and total size) and the continuation path. It leaves slightly ambiguous whether the count/size cover the whole chat or only the scanned window, which matters for a paged tool.

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

Parameters3/5

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

With 15 parameters and 67% schema description coverage, the schema does most of the semantic work (enums for types and format, ISO dates, extension lists). The description contributes only the generic phrase "with filters" and the return-field framing, adding little per-parameter meaning beyond what the schema already states.

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?

"List files in a chat" gives a specific verb and resource, and the parenthetical enumerates exactly what comes back (name, size, kind, date, link) plus aggregate count and total size. That precision lets an agent distinguish this file-listing tool from generic message or search tools without opening the schema.

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 the per-call scanning bound and the continuation mechanism (next_offset_id), and explicitly redirects to tg_index_chat or tg_export when a complete listing of a large chat is needed. It does not say when to prefer the sibling tg_search_files over listing with name_contains, but the decision for the big-chat case is spelled out.

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