GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): MCP tools no longer advertise non-string enums that Gemi… · orbitingflea/t3code@9504f65

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src
    • mcp
      • advertisedJsonSchema.test.ts
      • advertisedJsonSchema.ts
    • provider
      • agentContextBudget.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/mcp/advertisedJsonSchema.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/mcp/advertisedJsonSchema.test.ts
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as Schema from "effect/Schema";
33
import { Tool } from "effect/ai";
44

55
import { advertisedJsonSchema } from "./advertisedJsonSchema.ts";
6+
import { ThemeToolkit } from "./toolkits/theme/tools.ts";
67

78
it("drops JSON noise, merges tagged unions, and keeps null where it is required", () => {
89
const Every = Schema.Struct({ ms: Schema.Int });
@@ -43,3 +44,18 @@ it("drops JSON noise, merges tagged unions, and keeps null where it is required"
4344
required: ["beforeRunId", "every"],
4445
});
4546
});
47+
48+
it("advertises only string enum values, which Gemini requires", () => {
49+
const enumValues: Array<unknown> = [];
50+
const collect = (node: unknown): void => {
51+
if (Array.isArray(node)) return node.forEach(collect);
52+
if (typeof node !== "object" || node === null) return;
53+
for (const [key, value] of Object.entries(node)) {
54+
if (key === "enum" && Array.isArray(value)) enumValues.push(...value);
55+
else collect(value);
56+
}
57+
};
58+
collect(advertisedJsonSchema(ThemeToolkit.tools.t3_theme_set));
59+
60+
expect(enumValues.filter((value) => typeof value !== "string")).toEqual([]);
61+
});
Collapse file

‎apps/server/src/mcp/advertisedJsonSchema.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/mcp/advertisedJsonSchema.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const SAFE_INTEGER_BOUNDS: Record<string, number> = {
2121
minimum: Number.MIN_SAFE_INTEGER,
2222
};
2323

24+
// Gemini rejects function declarations whose enums hold anything but strings.
25+
const isNonStringEnum = (key: string, value: Json) =>
26+
key === "enum" && Array.isArray(value) && value.some((item) => typeof item !== "string");
27+
2428
const tagOf = (branch: JsonObject, key: string): Json => {
2529
const property = Predicate.isObject(branch.properties) ? branch.properties[key] : undefined;
2630
return Predicate.isObject(property) && Array.isArray(property.enum) && property.enum.length === 1
@@ -75,6 +79,7 @@ const compact = (schema: Json, optional: boolean): Json => {
7579
for (const [key, value] of Object.entries(schema)) {
7680
if (key === "additionalProperties" && value === true) continue;
7781
if (SAFE_INTEGER_BOUNDS[key] === value) continue;
82+
if (isNonStringEnum(key, value)) continue;
7883
result[key] =
7984
key === "properties" && Predicate.isObject(value)
8085
? Object.fromEntries(
Collapse file

‎apps/server/src/provider/agentContextBudget.json‎

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"claudeSystemAppendBytes": 5930,
33
"codexAdditionalContextBytes": 7324,
4-
"mcpToolListJsonBytes": 49749
4+
"mcpToolListJsonBytes": 49738
55
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.