Skip to main content
Glama
Telegram Ads MCP

Telegram Ads MCP

Execute a Telegram Ads script

tg_execute
Destructive

Run JavaScript in an isolated sandbox to automate multi-step Telegram Ads tasks such as bulk edits, pagination, joins, and cross-ad analysis without many separate tool calls.

Instructions

Run JavaScript in an isolated QuickJS sandbox with a typed tg object, for multi-step work that would otherwise need many tool calls: bulk edits, cross-ad analysis, pagination, joins and reports. Only console.log output and the returned value come back. No network, filesystem, process or env access. Calls run sequentially; the limit is 25 API calls, 15 seconds and 64 KB of output. Example: const ads = await tg.getAdsList({limit: 100}); return ads.ads.length. Write methods require TG_ADS_MODE=write, TG_ADS_CODE_MODE=write and confirm: true.

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": {
      "code": "<code>"
    },
    "name": "tg_execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesAn async arrow function, a function expression, or a plain statement body.
confirmNoRequired before any write method can run.
idempotency_keyNoPrefix for write idempotency keys, useful when retrying a script.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.3

TDQS

A4.5/5.0
Behavior5/5

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

The description adds substantial behavior beyond the annotations: sandbox isolation, restricted environment access, sequential execution, API-call/time/output limits, return behavior, and the extra requirements for write methods. These details materially help an agent understand execution constraints and safety conditions.

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?

The description is front-loaded with the core purpose and then layers use cases, behavior, limits, an example, and write prerequisites. Every sentence contributes useful information without unnecessary repetition.

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 complex sandboxed execution tool with no output schema, the description covers the essential context: what runs, what comes back, what is inaccessible, execution limits, and write gating. An agent has enough information to decide whether and how to invoke it.

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?

Schema coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds a useful code example and notes that confirm is required for writes, but it does not explain idempotency_key or add much parameter meaning beyond the schema.

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?

The description uses a specific verb and resource: run JavaScript in an isolated QuickJS sandbox with a typed tg object for Telegram Ads work. It clearly distinguishes this from single-operation siblings by emphasizing multi-step work such as bulk edits, cross-ad analysis, pagination, joins, and reports.

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 gives clear when-to-use guidance: multi-step work that would otherwise require many tool calls, with concrete examples. It also states write prerequisites, but it does not explicitly name simpler sibling tools as alternatives for single operations, so it falls just short of fully explicit routing guidance.

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