# feat\(mcp\): expose thread organization commands · PR \#10554 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/10554)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: merged

Source repository: pingdotgg/t3code

Source branch: agents/mcp-thin/thread-organization

Target branch: agents/mcp-shared/attachment-intake

Head commit: c03cefcfbabc1310d8c3f824f47d3e3b1115a0d7

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/10554)

[Commits](https://git.cafe/pingdotgg/t3code/pull/10554/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/10554/diffs?format=markdown)

## Description

---

Part 4/16 of the [shared-core and MCP stack](https://github.com/pingdotgg/t3code/stacks/10582). Based on [#10580](https://github.com/pingdotgg/t3code/pull/10580). Next: [#10555](https://github.com/pingdotgg/t3code/pull/10555).

Agents cannot invoke the existing pin, snooze, settle, archive and unread commands through MCP. This adds one scoped tool that dispatches those commands through ThreadManagementService.

This bottom layer also adds the shared caller/project/mode checks, fixed public errors and core MCP tests reused above. No lifecycle or command-service implementation changes. Deferred organization is not included.

MCP-only rebuild of [#8676](https://github.com/pingdotgg/t3code/pull/8676), preserving attribution to Julius Marminge's original work. Original branches remain available for separate service follow-ups.

Validation: The composed stack passes 94 tests across 12 focused files, including shared core MCP and real MCP/V2 integration, attachment intake, project RPC/service contracts, and client model command selection. Server/contracts/shared/client-runtime typechecks and targeted format/lint/diff checks pass. New behavior coverage lives with the shared operation; no per-tool mock suite was added. Current-head CI is shown below.

Layer size: 8 files, +308/-3. No domain-service production implementation or documentation files change in this MCP layer.

Prepared with Codex in the OpenAI agent runtime.

<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. -->
> [!NOTE]
> ### Add `t3_thread_organize` MCP tool to dispatch thread organization commands
> - Adds the `t3_thread_organize` tool schema and toolkit, then registers live handlers that map pin, unpin, snooze, unsnooze, settle, unsettle, archive, unarchive, and mark-unread actions to orchestration commands
> - Introduces thread-access helpers in [threadAccess.ts](https://github.com/pingdotgg/t3code/pull/10554/files#diff-9fdc0fbbd9b8cbc75caa1f310943dc30002dcae24fffaccf425b6b7fc8b99978): caller resolution requires the orchestration capability, thread lookup is scoped to the caller's project, and the active-owner guard rejects archived callers or provider mismatches with `parent_not_active`\n- Writable-thread validation fails when the target thread's runtime or interaction mode would broaden the caller's mode; missing `snoozedUntil` returns `invalid_request` and dispatch failures return the fixed public `orchestration_error` payload
> - Adds tests for schema uniqueness across toolkits, capability denial before the management service is used, storage-failure boundary behavior, and integration pin/unpin plus cross-project `thread_not_found`
> - Refactors turn-request launch error handling in [ws.ts](https://github.com/pingdotgg/t3code/pull/10554/files#diff-7f2100e8ffa23a58d9bf425c5b3ceafc39239911ae33bc569291a00ecb8e9125) into tag-specific mappers for `AttachmentClaimError`, `ThreadLaunchError`, and `ServerRuntimeStartupError`
> - Risk: mutation flows now enforce the active-owner guard in `assertLiveCaller`; any caller lacking an active run or owned by a different provider instance will receive `parent_not_active` where they previously may have succeeded
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized c03cefc.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- Macroscope's pull request summary ends here -->
