{
  "schemaVersion": "1.0",
  "item": {
    "slug": "tg-mtproto-cli",
    "name": "Telegram MTPROTO CLI",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/cyberash-dev/tg-mtproto-cli",
    "canonicalUrl": "https://clawhub.ai/cyberash-dev/tg-mtproto-cli",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/tg-mtproto-cli",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=tg-mtproto-cli",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/tg-mtproto-cli"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/tg-mtproto-cli",
    "agentPageUrl": "https://openagent3.xyz/skills/tg-mtproto-cli/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tg-mtproto-cli/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tg-mtproto-cli/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "tg — Telegram CLI via MTProto",
        "body": "CLI tool for reading Telegram data directly via MTProto protocol. No Bot API, no limits."
      },
      {
        "title": "Required binaries",
        "body": "BinaryInstallPurposetgnpm install -g tg-mtproto-cliCore CLIjq (optional)brew install jq or apt install jqJSON filtering in workflow examples\n\nSource and provenance:\n\nnpm: npmjs.com/package/tg-mtproto-cli\nGitHub: github.com/cyberash-dev/tg-mtproto-cli\n\nVerify after install:\n\ntg --version\nnpm ls -g tg-mtproto-cli"
      },
      {
        "title": "Required credentials",
        "body": "CredentialHow to obtainStorageTelegram api_id + api_hashmy.telegram.org/appsSystem keychain (macOS Keychain / Windows Credential Vault / Linux Secret Service)Phone number + OTP codeInteractive prompt during tg authNot persisted; used once for session creation\n\nCredentials are entered interactively via tg auth. No environment variables required."
      },
      {
        "title": "Runtime surface",
        "body": "ResourceAccessDetailsNetworkOutbound TCP to Telegram DC serversMTProto protocol, required for all commandsSession filesRead/write ~/.tg-mtproto-cli/sessions/*.sessionSQLite databases with auth keys; created by tg authSystem keychainRead/writeStores api_id, api_hash, account metadata, default accountFilesystemWrite (only tg download)Saves media to --out dir or current directory"
      },
      {
        "title": "Guardrails",
        "body": "The CLI is read-only by design — it has no commands to send messages, create chats, modify groups, or perform any write operations on Telegram. The only write targets are local: session files and downloaded media.\ntg download writes files only to the explicitly specified --out directory or cwd.\nSession files contain sensitive auth material — do not read, copy, or expose ~/.tg-mtproto-cli/sessions/ contents.\nDo not log or display api_id / api_hash values.\nIf tg auth is needed, inform the user — it requires interactive input (phone, OTP) and cannot be automated."
      },
      {
        "title": "Chat identification",
        "body": "Chats can be referenced by:\n\nUsername: @username or username\nNumeric ID: -1001234567890 (groups/supergroups use negative IDs)\nPhone: +1234567890 (for private chats)\n\nTo find a chat's numeric ID, use tg chats --json | jq '.[] | {id, title}'."
      },
      {
        "title": "List chats",
        "body": "tg chats [--type private|group|supergroup|channel] [--limit 50] [--offset 0]"
      },
      {
        "title": "Read messages",
        "body": "tg messages <chat> [-n 100] [--all] [--topic <id>] [--after <datetime>]\n\nFlagDescription-n <count>Number of messages (default: 100)--allEntire history (shows progress)--topic <id>Forum topic (get IDs via tg topics <chat>)--after <datetime>Only messages after this time\n\n--after formats: 2026-02-22, 2026-02-22T10:00, 10:00 (today).\n\nWhen --after + -n are combined: filter by date first, then take last N."
      },
      {
        "title": "List forum topics",
        "body": "tg topics <chat>\n\nReturns topic IDs needed for --topic flag."
      },
      {
        "title": "Download media",
        "body": "tg download <chat> <messageId> [--out <dir>]\n\nDownloads the media attachment from a specific message. Get message IDs from tg messages output (shown as #<id>)."
      },
      {
        "title": "Account management",
        "body": "tg auth                          # authenticate (interactive)\ntg logout [alias]                # remove session\ntg accounts                      # list accounts\ntg accounts rename <old> <new>   # rename alias\ntg default <alias>               # set default"
      },
      {
        "title": "Global flags",
        "body": "FlagEffect--account <alias>Use specific account instead of default--jsonJSON output (for scripting/piping)"
      },
      {
        "title": "JSON output",
        "body": "All commands support --json for structured output. Dates are ISO 8601.\n\ntg chats --json\ntg messages @chat -n 10 --json\ntg download @chat 42 --json"
      },
      {
        "title": "Message JSON schema",
        "body": "{\n  \"id\": 42,\n  \"chatId\": -1001234567890,\n  \"senderName\": \"John\",\n  \"text\": \"Hello\",\n  \"date\": \"2026-02-22T10:15:00.000Z\",\n  \"media\": { \"type\": \"photo\", \"fileName\": null, \"mimeType\": \"image/jpeg\", \"size\": 262525 },\n  \"replyToId\": null,\n  \"isOutgoing\": false\n}\n\nmedia is null when no attachment. media.type: photo, video, document, audio, voice, sticker."
      },
      {
        "title": "Extract text from a chat since a date",
        "body": "tg messages @channel --after 2026-02-01 --json | jq -r '.[].text // empty'"
      },
      {
        "title": "Find messages with photos",
        "body": "tg messages @chat -n 500 --json | jq '[.[] | select(.media.type == \"photo\")]'"
      },
      {
        "title": "Download all photos from recent messages",
        "body": "for id in $(tg messages @chat -n 50 --json | jq -r '.[] | select(.media.type == \"photo\") | .id'); do\n  tg download @chat \"$id\" --out ./photos\ndone"
      },
      {
        "title": "Read a forum topic",
        "body": "tg topics -1001234567890          # find topic ID\ntg messages -1001234567890 --topic 42 -n 20"
      },
      {
        "title": "Multi-account usage",
        "body": "tg chats --account work\ntg messages @chat -n 10 --account personal"
      },
      {
        "title": "Exit codes",
        "body": "CodeMeaning0Success1Runtime error (invalid args, chat not found)2Auth required (no account, expired session) — run tg auth"
      },
      {
        "title": "Troubleshooting",
        "body": "\"No default account\" → run tg auth or use --account <alias>\n\"Session expired\" → run tg auth to re-authenticate\nChat not found → use numeric ID from tg chats --json\nEmpty messages → check chat ID sign (groups are negative)"
      }
    ],
    "body": "tg — Telegram CLI via MTProto\n\nCLI tool for reading Telegram data directly via MTProto protocol. No Bot API, no limits.\n\nRequired binaries\nBinary\tInstall\tPurpose\ntg\tnpm install -g tg-mtproto-cli\tCore CLI\njq (optional)\tbrew install jq or apt install jq\tJSON filtering in workflow examples\n\nSource and provenance:\n\nnpm: npmjs.com/package/tg-mtproto-cli\nGitHub: github.com/cyberash-dev/tg-mtproto-cli\n\nVerify after install:\n\ntg --version\nnpm ls -g tg-mtproto-cli\n\nRequired credentials\nCredential\tHow to obtain\tStorage\nTelegram api_id + api_hash\tmy.telegram.org/apps\tSystem keychain (macOS Keychain / Windows Credential Vault / Linux Secret Service)\nPhone number + OTP code\tInteractive prompt during tg auth\tNot persisted; used once for session creation\n\nCredentials are entered interactively via tg auth. No environment variables required.\n\nRuntime surface\nResource\tAccess\tDetails\nNetwork\tOutbound TCP to Telegram DC servers\tMTProto protocol, required for all commands\nSession files\tRead/write ~/.tg-mtproto-cli/sessions/*.session\tSQLite databases with auth keys; created by tg auth\nSystem keychain\tRead/write\tStores api_id, api_hash, account metadata, default account\nFilesystem\tWrite (only tg download)\tSaves media to --out dir or current directory\nGuardrails\nThe CLI is read-only by design — it has no commands to send messages, create chats, modify groups, or perform any write operations on Telegram. The only write targets are local: session files and downloaded media.\ntg download writes files only to the explicitly specified --out directory or cwd.\nSession files contain sensitive auth material — do not read, copy, or expose ~/.tg-mtproto-cli/sessions/ contents.\nDo not log or display api_id / api_hash values.\nIf tg auth is needed, inform the user — it requires interactive input (phone, OTP) and cannot be automated.\nChat identification\n\nChats can be referenced by:\n\nUsername: @username or username\nNumeric ID: -1001234567890 (groups/supergroups use negative IDs)\nPhone: +1234567890 (for private chats)\n\nTo find a chat's numeric ID, use tg chats --json | jq '.[] | {id, title}'.\n\nCommands reference\nList chats\ntg chats [--type private|group|supergroup|channel] [--limit 50] [--offset 0]\n\nRead messages\ntg messages <chat> [-n 100] [--all] [--topic <id>] [--after <datetime>]\n\nFlag\tDescription\n-n <count>\tNumber of messages (default: 100)\n--all\tEntire history (shows progress)\n--topic <id>\tForum topic (get IDs via tg topics <chat>)\n--after <datetime>\tOnly messages after this time\n\n--after formats: 2026-02-22, 2026-02-22T10:00, 10:00 (today).\n\nWhen --after + -n are combined: filter by date first, then take last N.\n\nList forum topics\ntg topics <chat>\n\n\nReturns topic IDs needed for --topic flag.\n\nDownload media\ntg download <chat> <messageId> [--out <dir>]\n\n\nDownloads the media attachment from a specific message. Get message IDs from tg messages output (shown as #<id>).\n\nAccount management\ntg auth                          # authenticate (interactive)\ntg logout [alias]                # remove session\ntg accounts                      # list accounts\ntg accounts rename <old> <new>   # rename alias\ntg default <alias>               # set default\n\nGlobal flags\nFlag\tEffect\n--account <alias>\tUse specific account instead of default\n--json\tJSON output (for scripting/piping)\nJSON output\n\nAll commands support --json for structured output. Dates are ISO 8601.\n\ntg chats --json\ntg messages @chat -n 10 --json\ntg download @chat 42 --json\n\nMessage JSON schema\n{\n  \"id\": 42,\n  \"chatId\": -1001234567890,\n  \"senderName\": \"John\",\n  \"text\": \"Hello\",\n  \"date\": \"2026-02-22T10:15:00.000Z\",\n  \"media\": { \"type\": \"photo\", \"fileName\": null, \"mimeType\": \"image/jpeg\", \"size\": 262525 },\n  \"replyToId\": null,\n  \"isOutgoing\": false\n}\n\n\nmedia is null when no attachment. media.type: photo, video, document, audio, voice, sticker.\n\nCommon workflows\nExtract text from a chat since a date\ntg messages @channel --after 2026-02-01 --json | jq -r '.[].text // empty'\n\nFind messages with photos\ntg messages @chat -n 500 --json | jq '[.[] | select(.media.type == \"photo\")]'\n\nDownload all photos from recent messages\nfor id in $(tg messages @chat -n 50 --json | jq -r '.[] | select(.media.type == \"photo\") | .id'); do\n  tg download @chat \"$id\" --out ./photos\ndone\n\nRead a forum topic\ntg topics -1001234567890          # find topic ID\ntg messages -1001234567890 --topic 42 -n 20\n\nMulti-account usage\ntg chats --account work\ntg messages @chat -n 10 --account personal\n\nExit codes\nCode\tMeaning\n0\tSuccess\n1\tRuntime error (invalid args, chat not found)\n2\tAuth required (no account, expired session) — run tg auth\nTroubleshooting\n\"No default account\" → run tg auth or use --account <alias>\n\"Session expired\" → run tg auth to re-authenticate\nChat not found → use numeric ID from tg chats --json\nEmpty messages → check chat ID sign (groups are negative)"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/cyberash-dev/tg-mtproto-cli",
    "publisherUrl": "https://clawhub.ai/cyberash-dev/tg-mtproto-cli",
    "owner": "cyberash-dev",
    "version": "0.1.4",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/tg-mtproto-cli",
    "downloadUrl": "https://openagent3.xyz/downloads/tg-mtproto-cli",
    "agentUrl": "https://openagent3.xyz/skills/tg-mtproto-cli/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tg-mtproto-cli/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tg-mtproto-cli/agent.md"
  }
}