From 41d6867789cc0d1a42f64a1d13b733929c0c33e5 Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Fri, 27 Nov 2026 19:01:20 +1100 Subject: [PATCH 1/2] Read the Gemini guide tool catalog past the MCP field table (#773) Deep Research's Supported tools section now includes an MCP servers field table whose Type cell is JSON `string`. The parser treated that cell as a tool type and failed every poll. Read only the catalog table, and keep throwing when the catalog itself names an unknown type. --- .../fixtures/gemini-deep-research.md.txt | 12 +++++++++- src/server/providers/gemini-features.ts | 24 +++++++++++++++---- src/server/providers/model-facts.ts | 6 ++++- src/server/providers/model-features.test.ts | 12 +++++++--- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/server/providers/fixtures/gemini-deep-research.md.txt b/src/server/providers/fixtures/gemini-deep-research.md.txt index db88d68e..bb436e11 100644 --- a/src/server/providers/fixtures/gemini-deep-research.md.txt +++ b/src/server/providers/fixtures/gemini-deep-research.md.txt @@ -23,6 +23,16 @@ specify tools to restrict or extend the agent's capabilities. | MCP Server | `mcp_server` | Connect to remote MCP servers for external tool access. | | File Search | `file_search` | Search your uploaded document corpora. | -### Google Search {% id="google-search" %} +### MCP servers {% id="mcp-servers" %} + +The Field column is the request field. Type is its JSON type, not a tool. + +| Field | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| `type` | `string` | Yes | Must be `"mcp_server"`. | +| `name` | `string` | No | A display name for the MCP server. | +| `headers` | `object` | No | Key-value pairs sent as HTTP headers. | +| `allowed_tools` | `array` | No | Restrict which tools from the server the agent may call. | + ## Steerability and formatting {% id="steerability-and-formatting" %} diff --git a/src/server/providers/gemini-features.ts b/src/server/providers/gemini-features.ts index 396877c6..32d061dd 100644 --- a/src/server/providers/gemini-features.ts +++ b/src/server/providers/gemini-features.ts @@ -112,17 +112,31 @@ const GUIDE_TOOL_FIELDS: ReadonlySet = new Set([ ]) /** - * A guide's `## Supported tools` table: each backticked Type value is the + * The first pipe table in `text`. A later table in the same section is a + * different statement (Deep Research types the MCP `type` field as JSON + * `string` under `### MCP servers`, #773). + */ +function firstMarkdownTable(text: string): Array> { + const lines: Array = [] + for (const line of text.split('\n')) { + if (line.startsWith('|')) lines.push(line) + else if (lines.length > 0) break + } + return markdownTableRows(lines.join('\n')) +} + +/** + * A guide's `## Supported tools` catalog: each backticked Type value is the * Interactions API name of a generateContent `Tool` field - * (`google_search` → `googleSearch`). A guide with no such section states - * nothing; a section that yields no Type value, or a Type value outside the - * known fields, throws (#707). + * (`google_search` → `googleSearch`). Only that first table is the catalog. + * A guide with no such section states nothing; a catalog that yields no + * Type value, or a Type value outside the known fields, throws (#707). */ export function parseGuideTools(markdown: string): Array { const start = markdown.search(/^## Supported tools\b/m) if (start < 0) return [] const section = markdown.slice(start).split(/^## /m)[1] ?? '' - const [header, ...rows] = markdownTableRows(section) + const [header, ...rows] = firstMarkdownTable(section) const column = header?.findIndex((cell) => /^type value$/i.test(cell)) ?? -1 if (column < 0) throw new Error('gemini guide: Supported tools has no Type value column') diff --git a/src/server/providers/model-facts.ts b/src/server/providers/model-facts.ts index daaf5c71..3f03de71 100644 --- a/src/server/providers/model-facts.ts +++ b/src/server/providers/model-facts.ts @@ -299,7 +299,11 @@ export const DOCS_TTL_SECONDS = 6 * 60 * 60 // v49: a Gemini model page entry gained `guide`, the guide its // Documentation section links (#707). A v48 entry has none, so agent rows // would read no guide tools for six hours. -const DOCS_CACHE_VERSION = 'v49' +// v50: a Gemini guide caches the Supported tools catalog only (#773). A v49 +// Deep Research entry is missing (the MCP field table's JSON `string` threw +// before the write) or is the catalog from before that table; either way the +// next poll must parse the page again instead of failing for six hours. +const DOCS_CACHE_VERSION = 'v50' /** Fresh-window key for one parsed docs page. Shared with the stale copy. */ export function docsCacheKey(url: string): string { diff --git a/src/server/providers/model-features.test.ts b/src/server/providers/model-features.test.ts index a3c137e5..fc576887 100644 --- a/src/server/providers/model-features.test.ts +++ b/src/server/providers/model-features.test.ts @@ -578,9 +578,10 @@ describe('gemini features (issue #77)', () => { it('reads a guide Supported tools table as generateContent fields (#707)', () => { // https://aistudio.google.com/docs/antigravity-agent.md and - // deep-research.md, 2026-11-21, cut down. `function` is a client - // tool; `mcp_server` becomes `mcpServer` by the same rule; Filesystem - // has no type value. + // deep-research.md, catalog from 2026-11-21, MCP field table from + // 2026-11-27, both cut down. `function` is a client tool; + // `mcp_server` becomes `mcpServer` by the same rule; Filesystem has + // no type value. The field table's JSON `string` is not a tool type. expect( parseGuideTools(fixture('gemini-antigravity-agent.md.txt')), ).toEqual(['codeExecution', 'googleSearch', 'urlContext', 'mcpServer']) @@ -601,6 +602,11 @@ describe('gemini features (issue #77)', () => { expect(() => parseGuideTools(guide.replace('`file_search`', '`file_lookup`')), ).toThrow(/file_lookup/) + // A catalog cell of `string` is an unknown tool type. The same word + // in the MCP field table, already in the fixture, is not. + expect(() => + parseGuideTools(guide.replace('`file_search`', '`string`')), + ).toThrow(/unknown Supported tools type "string"/) // A table that is there but yields no Type value is a changed format. expect(() => parseGuideTools(guide.replace(/`([a-z_]+)` \|/g, '$1 |')), From 824b83f096f3e5159d0762d6bb838ec8dc084811 Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Fri, 27 Nov 2026 19:02:02 +1100 Subject: [PATCH 2/2] Correct the v50 docs-cache note for the Gemini guide throw (#773) A failed guide load is not cached, so the bump only drops a catalog stored before the MCP field table arrived. --- src/server/providers/model-facts.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/providers/model-facts.ts b/src/server/providers/model-facts.ts index 3f03de71..191ddf06 100644 --- a/src/server/providers/model-facts.ts +++ b/src/server/providers/model-facts.ts @@ -300,9 +300,10 @@ export const DOCS_TTL_SECONDS = 6 * 60 * 60 // Documentation section links (#707). A v48 entry has none, so agent rows // would read no guide tools for six hours. // v50: a Gemini guide caches the Supported tools catalog only (#773). A v49 -// Deep Research entry is missing (the MCP field table's JSON `string` threw -// before the write) or is the catalog from before that table; either way the -// next poll must parse the page again instead of failing for six hours. +// entry was parsed from every table under the heading. Deep Research never +// stored one after the MCP field table arrived (its JSON `string` threw, and +// a failed load is not cached). The bump drops a v49 catalog stored before +// that table. const DOCS_CACHE_VERSION = 'v50' /** Fresh-window key for one parsed docs page. Shared with the stale copy. */