# Files changed · PR \#10557 · pingdotgg/t3code

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

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

Visibility: public

[feat\(mcp\): expose thread model selection](https://git.cafe/pingdotgg/t3code/pull/10557.md)

Version: 4

Head commit: b0152bc6413b878f786c6c2ef30770fde71e3bbc

Base commit: 51483abe7fe7d45839507cd982e24545658b95da

Comparison base: 51483abe7fe7d45839507cd982e24545658b95da

Showing up to 20 entries from this revision. If the pull request changes, reopen the first page before continuing.

## apps/server/src/mcp/toolkits/thread/handlers.ts

Status: modified; +30; −0

```diff
@@ -8,6 +8,7 @@
   type OrchestrationV2Command,
 } from "@t3tools/contracts";
 import * as Effect from "effect/Effect";
+import { modelSelectionCommandType } from "@t3tools/shared/model";
 
 import { newCommandId, readThread, readWritableThread, unavailable } from "../../threadAccess.ts";
 import { queuedRunsInDeliveryOrder } from "../../../orchestration-v2/QueuedRunOrder.ts";
@@ -60,6 +61,35 @@
   return { ...context, request, item };
 });
 export const ThreadToolkitHandlersLive = ThreadToolkit.toLayer({
+  t3_thread_configuration: (input) =>
+    Effect.gen(function* () {
+      const {
+        projection: { thread },
+      } = yield* readThread(input.threadId);
+      return {
+        threadId: thread.id,
+        modelSelection: thread.modelSelection,
+        runtimeMode: thread.runtimeMode,
+        interactionMode: thread.interactionMode,
+      };
+    }),
+  t3_thread_configure: (input) =>
+    Effect.gen(function* () {
+      const {
+        threads,
+        projection: { thread },
+      } = yield* readWritableThread();
+      const type = modelSelectionCommandType(thread.providerInstanceId, input.modelSelection);
+      const result = yield* threads
+        .dispatch({
+          type,
+          threadId: thread.id,
+          commandId: yield* newCommandId(),
+          modelSelection: input.modelSelection,
+        })
+        .pipe(Effect.mapError(unavailable));
+      return { sequence: result.sequence };
+    }),
   t3_pending_request_list: (input) =>
     Effect.gen(function* () {
       const { projection } = yield* readThread(input.threadId);
```

## apps/server/src/mcp/toolkits/thread/tools.ts

Status: modified; +26; −0

```diff
@@ -1,4 +1,7 @@
 import {
+  ModelSelection,
+  RuntimeMode,
+  ProviderInteractionMode,
   RuntimeRequestId,
   ProviderUserInputAnswers,
   IsoDateTime,
@@ -150,7 +153,30 @@
   .annotate(Tool.Destructive, true)
   .annotate(Tool.OpenWorld, true);
 
+export const ThreadConfigurationTool = Tool.make("t3_thread_configuration", {
+  ...commandTool,
+  description:
+    "Read a thread's provider/model selection and modes in the calling project. orchestrator_capabilities lists available providers and models.",
+  parameters: Schema.Struct({ threadId: Schema.optional(ThreadId) }),
+  success: Schema.Struct({
+    threadId: ThreadId,
+    modelSelection: ModelSelection,
+    runtimeMode: RuntimeMode,
+    interactionMode: ProviderInteractionMode,
+  }),
+})
+  .annotate(Tool.Readonly, true)
+  .annotate(Tool.Destructive, false);
+export const ThreadConfigureTool = Tool.make("t3_thread_configure", {
+  ...commandTool,
+  description:
+    "Set this calling thread's provider, model and options with the existing selection command. This does not change permission modes or other threads. Use orchestrator_capabilities to choose a selection.",
+  parameters: Schema.Struct({ modelSelection: ModelSelection }),
+}).annotate(Tool.Destructive, true);
+
 export const ThreadToolkit = Toolkit.make(
+  ThreadConfigurationTool,
+  ThreadConfigureTool,
   PendingRequestListTool,
   PendingRequestReadTool,
   PendingRequestRespondTool,
```

## apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts

Status: modified; +1; −0

```diff
@@ -810,6 +810,7 @@
   "mcp__t3-code__t3_thread_wait",
   "mcp__t3-code__t3_pending_request_list",
   "mcp__t3-code__t3_pending_request_read",
+  "mcp__t3-code__t3_thread_configuration",
   "mcp__t3-code__t3_queue_list",
   "mcp__t3-code__t3_queue_read",
 ];
```

## packages/shared/src/t3McpToolPresentation.ts

Status: modified; +2; −0

```diff
@@ -57,6 +57,8 @@
   t3_pending_request_list: { displayName: "List pending questions" },
   t3_pending_request_read: { displayName: "Read pending questions" },
   t3_pending_request_respond: { displayName: "Answer pending questions" },
+  t3_thread_configuration: { displayName: "Read thread configuration" },
+  t3_thread_configure: { displayName: "Set thread model" },
   t3_thread_organize: { displayName: "Organize a thread" },
   t3_thread_update: { displayName: "Update T3 thread metadata" },
   t3_thread_send: { displayName: "Send to a T3 thread", summaryAction: "thread-send" },
```
