Repository navigation
[Bug]: Pi sessions declare every t3-code tool on every turn #16651
Description
Activity
Note
Grok responding on behalf of Julius.
Confirmed on
main@ 517188b — this is a real prefix-bloat bug in the Pi T3 MCP extension bridge.What main does
In
piT3McpExtensionSource.ts, aftertools/listthe extension loops every tool and callspi.registerTool({...})with name/label/description/promptSnippet/promptGuidelines/parameters/execute — and noexposure. With Pi’s default ofdirect, every schema + snippet + guideline line lands in the active tool prefix on every turn (and again on every delegated Pi child).The file header still says “Pi core has no MCP client,” which looks outdated relative to Pi 1.0’s built-in MCP support (
registerMcpServer), while T3’s gate is still:// apps/server/src/provider/PiProvider.ts export const MINIMUM_PI_VERSION = "0.80.5";
Tool surface (cheap static count)
McpHttpServerregisters toolkits onto/mcpstatically (layermerge); session capabilities gate calls, not listing. Across the toolkittools.tsfiles on main there are 80Tool.maketools (79 string names +html_render). That matches the reporter’s “~79 on main / ~72 in one live session” ballpark; we did not re-measure live prefix chars/tokens.Related (not duplicates)
- feat(mcp): shared MCP servers reach every agent session #16466 / feat(cua): attach the managed Cua Driver to every provider session #16528 — more MCP tools through the same registration path (would make this worse, not fix it)
- [Bug]: V2 Pi MCP bridge drops image blocks; fix from #13777 remains unmerged #15869 / [Bug]: Pi adapter kills the session when an extension starts a wake turn while T3 has no active turn #15589 — other Pi MCP / adapter issues
Fix direction (no open fix PR found)
Agree with the reporter’s sketch:
- Prefer
exposure: "codemode"(or"deferred") for most tools, with a short DIRECT_TOOLS allowlist (delegate_task/task_status/ … — exact set is a product call), or - On Pi ≥1.0, switch the extension to
pi.registerMcpServer(..., { exposure: "codemode" })and drop the hand-rolled client onceMINIMUM_PI_VERSIONcan move.
Either way the bug is the missing non-direct exposure default, not “whether T3 should have MCP tools.”
Verdict: valid eng bug — ready to track / fix. Exact DIRECT_TOOLS membership can land in the fix PR.
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.via-triageFiled through npx t3 triageFiled through npx t3 triage
on Oct 7, 2026
Before submitting
Area
apps/server
Steps to reproduce
toolsAddedentries namedmcp__t3-code__*and check the first assistantusage.Expected behavior
T3 tools a session rarely uses aren't declared on every turn. Pi 0.99+ supports this for extension tools:
registerTooltakesexposure(codemode,deferred), and inactive tools also leave out theirpromptSnippetandpromptGuidelines(extensions.md, Tool exposure).Actual behavior
piT3McpExtensionSource.tsregisters everytools/listresult withpi.registerTool()and noexposure, so all of them default todirect. Each one sends its full schema plus a snippet line and a guideline line.From one Pi session on Opus:
That's about 116k of the 287k-char prefix, roughly 46k tokens at the 2.5 chars per token this session measured (first turn: 114.5k input tokens). Every delegated Pi child pays it again. Children get the same list as the orchestrator, because
McpHttpServer.tsregisters toolkits statically and session capabilities only gate calls.main(517188b) registers tools the same way and defines 79. #16466 and #16528 add more through the same path.Impact
Minor bug or occasional failure
Version or commit
0.0.46-nightly.20261006.2735, also checked main @ 517188b
Environment
macOS 26.7.1, T3 Code Nightly desktop, pi 1.0.4, anthropic/claude-opus-5-5 and claude-sonnet-5-5
Workaround
Untested: a second Pi provider instance for children, with
--exclude-tools 'mcp__t3-code__*'in its launch arguments.Possible fix, for Pi 0.99 or newer (
MINIMUM_PI_VERSIONis still 0.80.5):DIRECT_TOOLSwould be a short list such asdelegate_taskandtask_status. Alternatively, Pi 1.0 ships a built-in MCP client, so the extension could callpi.registerMcpServer("t3-code", { url, headers, exposure: "codemode" })instead of running its own client. The comment saying "Pi core has no MCP client" is out of date.