Skip to content

MCP answers to 8,000 characters, Discord's long replies as one message, a press's toast, and a link previews setting - #52

Merged
robdevops merged 17 commits into
mainfrom
claude/answer-cap
Dec 2, 2026
Merged

robdevops merged 17 commits into
mainfrom
claude/answer-cap

Conversation

@robdevops

@robdevops robdevops commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Four changes: MCP answers capped at 8,000 characters, Discord's long replies as one message, a toast for a plain server's press, and no link previews.

MCP answers to 8,000 characters

  • maxAnswer (a direct command's answer, a feed item, an addon's post and a buttons op's text) goes from 4,000 to 8,000, so a long answer such as finbot's /holdings goes whole instead of losing its end: the most every network already sends as one reply (maxReply), split where the network needs it. An 8,000-character answer is 2 messages on Telegram, one or two on Discord (below), one message of 3 sections on Slack, and one on Signal (folded behind Read more).
  • The outbox still merges an addon's posts while their texts together stay within the cap.

Discord: a long reply as one message

  • A reply past 2,000 characters goes as one message where it fits: its text is the first 1,900 characters (so its @mentions notify), and the rest goes on in embeds below it (each description up to 4,096, at most 10 and 5,800 together, under Discord's 6,000), each cut from the text to the room left (mdstyle.Cut), shortened until its Markdown fits, and never through a masked link, a bare URL or a mention where it fits whole (a link too long for any message's text keeps its text without the URL; one too long for an embed's room left goes to the next message, with the cut before it). That is about 7,700 characters a message; past it, a second message the same way. Buttons stay under the last message, pictures with the first.
  • A mention notifies only in a message's text (Discord's rule), so an embed's @Name stays as written.
  • An edit sends the embeds too (embeds: [] when the text now fits alone), as does a slash command's @original answer.
  • Quoting the bot's own message reads its rich embeds' text after its own, so a reply to a long answer quotes all of it; anyone else's embeds (a link's preview) are never read.
  • A new Caps.Fits(text, known) says exactly whether a text goes out as one message; Discord's packs it as a post and an edit are packed. A feature asks the chat's Net.Fits, which Bot.Net binds to the chat's names as Send gets them, and oneMessage uses it, so buttons go under longer answers and presses edit them in place. The prompt no longer says a message holds 2,000 characters.

A plain server's press can answer with a toast

  • A press result with no content and _meta io.github.robdevops.signalbot/toast shows that text to the presser for a moment (at most 200 characters), the post left as it was, such as why the press can't be done ("8 tickers at most"). addon.ResultMeta.Toast and schema.json declare it.

Link previews: one setting, off by default

  • LINK_PREVIEWS (false by default; true, yes, on, 1) turns previews of the links in the bot's messages on for every network that makes them. Documented in docs/CONFIGURATION.md, and kept from addons as a core setting.
  • Telegram: link_preview_options: {is_disabled: …} on sendMessage and editMessageText.
  • Discord, off: every link is written <url> or [text](<url>) (the suppress-embeds flag would also hide a long reply's embeds), a bare URL found and ended as Discord's autolinker does (trailing punctuation outside, balanced brackets in, after CJK text, a link or code; never in a link's text; one written <url> left as it is); a press's answer carries flag 4; a message read has each <url> back as the URL.
  • Markdown parsing (all networks): a masked link's URL keeps its own parentheses (Wikipedia's), and [text](<url>) is read as the URL; a known @name inside a URL (youtube.com/@name) stays the URL's, never a mention.
  • Slack: unfurl_links and unfurl_media follow it (were always off). Signal makes none for a bot's messages.

Tests

  • Discord: a 4,500-character reply is one message with an embed and all its words; 8,000 is two messages within every limit, the buttons under the second; Fits agrees with what is sent for heavily escaped text, long lines and short ones; an embed's name stays as written; a long edit carries an embed and a short one clears them; a slash command's long answer has its embed in the @original PATCH; a quote of the bot reads its embeds, and a user's link preview is never read in; text whose Markdown is twice as long or more (escaped runs, long links, mentions) packs within limits with a time limit; a seeded fuzz of 300 replies checks Fits against what is sent, every limit, every word, and links whole; Bot.Net binds the chat's names. Each network's previews follow LINK_PREVIEWS, off and on.
  • MCP: a press's toast, cut to 200 characters.
  • TestOutbox and TestScenarioGroupChatterIsContext waited for log lines by time; on a loaded CI machine they failed (on 63ad4ce and ecfa2bc). Each now waits for the line itself.

Twelve rounds of adversarial review (three reviewers each, with random fuzzing of up to some 200,000 replies a round) found and fixed hangs, panics, over-limit messages, Fits disagreeing with what was sent, cut links and URLs, and URL wrapping errors; each fix has a test that fails without it. The twelfth round found nothing. go vet, go test -race ./... and the toolchain's gofmt are clean. Docs: TECHNICAL.md, docs/FILES_LINKS_TOOLS_MCP.md, README.md.

https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH


Generated by Claude Code

maxAnswer (a direct command's answer, a feed item, an addon's post and a buttons op's text) goes from 4,000 to
8,000, the most any network sends as one reply (maxReply), so a long answer such as finbot's /holdings goes whole,
split into messages where the network needs it (Telegram 2, Discord about 5), instead of losing its end. The outbox
merges posts while their texts together stay within it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
robdevops pushed a commit to robdevops/finbot that referenced this pull request Dec 2, 2026
Signalbot's cap on an MCP answer is 8,000 characters (robdevops/signalbot#52), as every network's on one reply, so
finbot's cut and the Markdown dialect's limit follow it, and a cut answer ends with "✂️ Cut short: the rest is too
long for one answer." rather than a bare ellipsis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…0 ms

On a loaded CI machine the read could come after the first post was said sent, so "two" went out alone and the
test failed (CI on 63ad4ce). It now waits for the addon's log to show a read of two or more ops first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…efore counting log lines

The Signal adapter logs its groups once the bot has started, at its own pace; on a loaded CI machine the line
came after the test counted the log, and was taken for logged chatter (CI on ecfa2bc).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
A reply past one message's 2,000 characters goes on in embeds below its
text (each up to 4,096, 5,800 together, 10 at most), so an 8,000-character
answer is one message; mentions notify from its text alone. An edit sends
the embeds too, none when the text fits alone; a quoted bot message reads
its embeds. Discord's Caps.Text rises to half what one message holds.

A plain server's press result with no content may carry _meta
io.github.robdevops.signalbot/toast, shown to the presser, the post left
as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The review found that halving the limits didn't keep a reply to one
message: parts cut early and escapes left 3,850 characters going out as
two, so buttons went under a post never kept and an edit dropped its end.
A reply is now cut from the text itself (mdstyle.Cut), the message's text
first, then each embed to the room left, a cut shortened until its
Markdown fits; Caps.Fits packs a text the same way and says whether it is
one message, which oneMessage uses before Caps.Text. An embed's @NAMEs stay
as written (no mention to notify), an edit too long for one message warns,
and only the bot's own quoted message has its embeds read: a user's link
preview is never part of their message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
@robdevops robdevops changed the title MCP answers capped at 8,000 characters, as every network caps one reply MCP answers to 8,000 characters, Discord's long replies as one message, and a press's toast Dec 2, 2026
…ntions

The verification found take() could cut to nothing or below: text whose
Markdown is twice as long as it or more (a run of escaped | or *, a list of
links, known names' mentions) made pack loop without end or panic in
mdstyle.Cut. A cut now shrinks in proportion to how much too long it is,
never under one character, so each take holds something. Fits packed
without the chat's names, which Send turns into longer mentions, so it could
say one message where Send made two; it now counts every @word as the
longest mention. Tests for each case, with a time limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…room

The second verification found Fits' guess at mentions could still say one
message where Send made two (a long or underscored @word written out
escaped, @al. with its dot, a name starting with an emoji), and a link
whose URL outgrew an embed's room went out whole, past Discord's 6,000.
Caps.Fits now takes the names to send with, and a feature asks Net.Fits,
which Bot.Net binds to the chat's names as Send gets them: exact, not a
guess. A piece that can't be cut to fit, a link with an outsized URL,
keeps its text without the link. Tests for each case found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
Link previews off: Telegram's sendMessage and editMessageText carry
link_preview_options is_disabled; on Discord every link is written <url>
or [text](<url>), as its suppress-embeds flag would hide a long reply's
embeds too, and a message read has each <url> as the URL. Slack's were off
already, and Signal sends none.

The third verification found a link too long for the room left shredded
into one- and two-character pieces, and Fits packing without the leading
echo of the bot's name that Send strips. A cut now never goes through a
link: it ends before it, or after a link that starts the piece; an embed's
room too small for a link leaves it to the next message; a link longer than
a message's text holds keeps its text without the link. Fits checks both
ways a text is packed, a post's and an edit's. A seeded fuzz test of 300
replies checks Fits against what is sent, every limit, every word, and
links whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
@robdevops robdevops changed the title MCP answers to 8,000 characters, Discord's long replies as one message, and a press's toast MCP answers to 8,000 characters, Discord's long replies as one message, a press's toast, and no link previews Dec 2, 2026
Previews of the links in the bot's messages follow one setting, off unless
LINK_PREVIEWS is true, yes, on or 1: Telegram's link_preview_options on
sends and edits, Discord's <url> wrapping (off) or links as written (on),
and Slack's unfurl_links and unfurl_media. Documented, a core setting kept
from addons, and tested off and on for each network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
@robdevops robdevops changed the title MCP answers to 8,000 characters, Discord's long replies as one message, a press's toast, and no link previews MCP answers to 8,000 characters, Discord's long replies as one message, a press's toast, and a link previews setting Dec 2, 2026
The fourth verification found the <url> wrapping took in trailing
punctuation and closing brackets or quotes (see <https://x.io/a.>), put a
style's closing marker inside the brackets (**<https://x.io/a**>), and
wrapped a URL already written <url> again. A bare URL now ends at white
space, a change of style, a link or a mention, less trailing punctuation,
quotes and closing brackets but a ) that closes a ( in it, and one written
<url> is left as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…es or <>

The fifth verification found, with previews off: a masked link written
[text](<url>) wrapped twice; a bare URL running on through a < (an HTML
<br>); a bare URL cut between a message and its embed though it fit whole
in the embed; a known @name inside a URL (youtube.com/@name) made a
mention, pinging that person and breaking the link; a masked URL with
parentheses (Wikipedia's) ending at its first ); an IPv6 host losing its
]; and a press's answer still previewing its links.

mdstyle's link parsing balances a URL's own parentheses and takes [text](<url>)
as the URL; a bare URL ends at a <, keeps a ] that closes a [, is never cut
through where it fits whole (urlRuns), and holds no mentions; a press's
answer has flag 4 unless LINK_PREVIEWS is on. Tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
… link's

The sixth verification found a bare URL that starts a piece still cut at
the end of the room an embed had left, though the next message's text held
it whole, and a URL written in a masked link's text taken for a bare URL,
which split the link at a cut and was wrapped in <> inside the link's text.
Such a URL now moves to the next message (take's ok=false, as a link's
does) and is cut through only where no message holds it; a URL in a link's
text is the link's (bareRuns), never wrapped. Tests for both, which fail
on the previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The seventh verification found that since a URL in a link's text is no
longer wrapped, it stayed a bare URL past the link's end, so text right
after the link was neither escaped (a~~b~~c struck through) nor had its own
URL wrapped. A link's start and end now end any bare URL. Tests for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The eighth verification found, mostly from before this PR: text after a
URL written <url> left unescaped; a URL in a link's text left unescaped,
though Discord never links there; a URL straight after CJK text, a link or
inline code not taken for one (so previewed, escaped and its @name a
mention); and a known name with a space cut at that space, its mention
lost. A URL now starts where Discord's autolinker starts one (not after an
ASCII letter, digit or _; after a link or code), never in a link's text;
one written <url> ends at its >; and a cut never goes through a mention.
Tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The ninth verification found a URL after a < with no > (an unclosed <url>,
or one with a space before its >) taken as written <url> already, so not
wrapped and still previewed, and a link preview of type rich (an X post's)
read into a quote of the bot's message as the bot's words. A URL is taken as
written <url> only where its > closes it, and a quote reads only embeds with
no url, the bot's own. Tests for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…ckets

The tenth verification found that links side by side ([1](u)[2](u)), whose
shortest cut holds both, made take give up at its floor with a piece far
over its room: a message's embeds past Discord's 6,000, or its text past
2,000, which Discord refuses, losing the whole reply though Fits said one
message. At the floor, take now cuts after the first link (or mention or
URL) that fits, else after one character. A URL written <url> is kept with
its brackets at a cut. A test of each case, which fails on the previous
commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The eleventh verification found no reply over Discord's limits in some
200,000 random ones, and Fits always agreeing with what was sent; it found
two cuts in poor places. A link too long for what is before it shrank the
cut by its own size, so the cut fell mid-word and a sentence went into tiny
embeds (Sources | :); the cut now goes before that link, at a line break or
space. A known name with a space at a URL's end (youtube.com/@john Smith)
was kept whole by cutting through the URL; a name in a URL is the URL's,
as markdown already writes it. Tests for both, which fail on the previous
commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
@robdevops
robdevops merged commit d8bd5d3 into main Dec 2, 2026
1 check passed
robdevops pushed a commit to robdevops/finbot that referenced this pull request Dec 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
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.

2 participants