Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): advertised MCP schemas merge tagged unions into one object #25125

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit intofeat/mcp-schema-noise fromfeat/mcp-schema-tagged-unionsopened View on GitHub

Showing 2 changed files with 57 additions and 15 deletions.

x
0 of 2 viewed, 2 left
8 additions and 13 deletionsapps/server/src/mcp/advertisedJsonSchema.test.tsModified
View file
@@ -4,7 +4,7 @@
​
import { advertisedJsonSchema } from "./advertisedJsonSchema.ts";
​
-it("drops JSON noise but keeps null where it is required", () => {
+it("drops JSON noise, merges tagged unions, and keeps null where it is required", () => {
const Every = Schema.Struct({ ms: Schema.Int });
const tool = Tool.make("example", {
parameters: Schema.Struct({
@@ -31,18 +31,13 @@
limit: { type: "integer" },
every: { type: "object", properties: { ms: { type: "integer" } }, required: ["ms"] },
target: {
- anyOf: [
- {
- type: "object",
- properties: { kind: { type: "string", enum: ["url"] }, url: { type: "string" } },
- required: ["kind", "url"],
- },
- {
- type: "object",
- properties: { kind: { type: "string", enum: ["number"] }, number: { type: "integer" } },
- required: ["kind", "number"],
- },
- ],
+ type: "object",
+ properties: {
+ kind: { type: "string", enum: ["url", "number"] },
+ url: { type: "string" },