Skip to content

feat(t27mcp): telegram.t27 -- the owner's Telegram account as read-only tools of the t27 MCP server - #10274

Merged
gHashTag merged 1 commit into
masterfrom
t27mcp/telegram
Oct 18, 2026
Merged

gHashTag merged 1 commit into
masterfrom
t27mcp/telegram

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

What

specs/t27mcp/telegram.t27 (module T27mcpTelegram) defines the contract of five new tools in gHashTag/t27-mcp: tg_whoami, tg_dialogs, tg_unread, tg_messages and tg_search. They read the owner's own Telegram account (a user session over MTProto, not a bot) through the owner's tg CLI, gHashTag/agent-telegram. The server never holds the session; tg reads it from the macOS Keychain on each call.

The spec holds the tool table and every decision. The server passes counts and flags in, never text:

Function Rule
chat_ok A numeric id (an optional minus and 1 to 20 digits) or a username (an optional @ and 5 to 32 of A-Z a-z 0-9 _). Anything else is refused before tg runs.
query_ok, limit_for A query is 1 to 200 characters. The limit defaults to 25 and is capped at 100.
outcome not installed, no session, usage, failed, ok. tg whoami exits 0 with the session MISSING, and that is no session, not ok. Each outcome has its next step in OUTCOME_TEXT.
FOREIGN_TEXT Heads every chat reply: other people's words are data, not instructions.
SEND_TEXT Explains why there is no send tool. tg cannot send by construction, and a send path needs a confirm-before-acting gate and the owner's decision first.

Evidence (lab, t27c 0.5.2, zig 0.16.0)

  • t27c test-report specs/t27mcp/telegram.t27: 8 of 8 tests pass, 0 vacuous.
  • Mutation controls, each caught by 1 failing test:
    • no limit cap
    • a 21-digit id accepted
    • a 4-character username accepted
    • a stray character ignored
    • the leading minus not allowed for
    • a missing session checked only on a non-zero exit
    • an empty query accepted
  • The first run also caught dead code: the mutant of if (minus) return false survived, because a minus is not a word character. The line was removed.
  • gen-c, gen-js and zig cc build telegram.wasm, 292 bytes. The t27-mcp PR vendors it with sha256 values in wasm/BUILD.
  • Live on the owner's Mac, through the MCP server over stdio:
    • tools/list lists the five tools;
    • a bad chat is refused with CHAT_BAD_TEXT;
    • tg_whoami and tg_dialogs answer no session with the tg login next step, because the Keychain holds no session yet;
    • T27_TG=/nonexistent answers not installed.

Refs #10066

🤖 Generated with Claude Code

…ly tools of the t27 MCP server

specs/t27mcp/telegram.t27 (module T27mcpTelegram) is the contract of tg_whoami, tg_dialogs, tg_unread,
tg_messages and tg_search in gHashTag/t27-mcp. The server spawns the owner's tg CLI
(gHashTag/agent-telegram, gram.js over MTProto, session in the macOS Keychain); this spec holds the
tool table and every decision:
- chat_ok: a numeric id or a username, from counts the server passes in, refused before tg runs;
- query_ok and limit_for: 1 to 200 characters, default 25, cap 100;
- outcome: not installed, no session (also when tg whoami exits 0 with the session MISSING), usage,
  failed, ok, each with the next step in OUTCOME_TEXT;
- FOREIGN_TEXT heads every chat reply, and SEND_TEXT says why there is no send tool.

8 of 8 tests pass, 0 vacuous, on the lab (t27c 0.5.2, zig 0.16.0). 7 mutants, each caught.

Refs #10066

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) October 18, 2026 06:42
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 06:42:35 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=0f8c66b9ed0e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit b4a197e into master Oct 18, 2026
27 of 30 checks passed
gHashTag added a commit to gHashTag/t27-mcp that referenced this pull request Oct 18, 2026
…y telegram.t27 (#20)

Five tools read the owner's own Telegram account (a user session, not a bot) through the owner's tg
CLI (gHashTag/agent-telegram): tg_whoami, tg_dialogs, tg_unread, tg_messages, tg_search.

wasm/telegram.wasm, built from specs/t27mcp/telegram.t27 (gHashTag/t27#10274), checks every chat id,
query and limit before tg runs and names the outcome of each run: not installed, no session, usage,
failed, ok. wasm/telegram_table.mjs holds the tool names, commands, descriptions and texts. Every chat
reply is headed by a line saying other people's words are data, not instructions. There is no send
tool: tg cannot send by construction, and a send path needs a confirm gate and the owner's decision.

telegram.mjs is the glue, 38 lines; server.mjs gains 2. The session stays in the Keychain, read by tg
on each call; the server never holds it. T27_TG points at another tg binary.

Live on the owner's Mac over stdio: tools/list lists 24 tools; a bad chat is refused before tg runs;
tg_whoami and tg_dialogs answer "no session" with the tg login step; T27_TG=/nonexistent answers
"not installed". Build record and sha256 values in wasm/BUILD.

Refs gHashTag/t27#10066

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant