Skip to content

Commit 182b27b

Browse files
EtanHeyclaude
andcommitted
fix(server): delegate_task and create_threads say where a target's providerInstanceId comes from
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 79f1fad commit 182b27b

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎apps/server/src/mcp/toolkits/orchestrator/tools.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as Exit from "effect/Exit";
33
import * as Schema from "effect/Schema";
44
import { Tool } from "effect/ai";
55

6+
import { advertisedJsonSchema } from "../../advertisedJsonSchema.ts";
67
import { OrchestratorToolkit } from "./tools.ts";
78

89
// Oversized page sizes clamp on decode, so the schema has no `maximum`; Codex also drops
@@ -27,3 +28,22 @@ it("refuses a t3_thread_update whose fields do not fit its action", () => {
2728
true,
2829
);
2930
});
31+
32+
it("tells agents where a target's providerInstanceId comes from", () => {
33+
type Schema = {
34+
readonly properties?: Record<string, Schema>;
35+
readonly items?: Schema;
36+
readonly description?: string;
37+
};
38+
const { delegate_task, create_threads } = OrchestratorToolkit.tools;
39+
const delegate = advertisedJsonSchema(delegate_task) as Schema;
40+
const threads = advertisedJsonSchema(create_threads) as Schema;
41+
for (const target of [
42+
delegate.properties?.target,
43+
threads.properties?.threads?.items?.properties?.target,
44+
]) {
45+
expect(target?.properties?.providerInstanceId?.description).toBe(
46+
"From orchestrator_capabilities.",
47+
);
48+
}
49+
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"claudeSystemAppendBytes": 5129,
33
"codexAdditionalContextBytes": 6859,
4-
"mcpToolListJsonBytes": 46109
4+
"mcpToolListJsonBytes": 46205
55
}

‎packages/contracts/src/orchestratorMcp.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ export type OrchestratorMcpTargetOptions = typeof OrchestratorMcpTargetOptions.T
9595

9696
export const OrchestratorMcpTarget = Schema.Struct({
9797
providerInstanceId: Schema.optional(
98-
ProviderInstanceId.annotate({
99-
description: "Provider instance id from `orchestrator_capabilities`.",
100-
}),
98+
// JSON Schema shows a transform's encoded side, so `.annotate` would never reach tools/list.
99+
ProviderInstanceId.pipe(
100+
Schema.annotateEncoded({ description: "From orchestrator_capabilities." }),
101+
),
101102
),
102103
driverKind: Schema.optional(
103104
ProviderDriverKind.annotate({

0 commit comments

Comments
 (0)