Skip to content

fix(mcp,genkit): clear unavailable vision backend hints on local servers and remove computed allocation size in mergeDependsOn - #60

Merged
ghchinoy merged 2 commits into
mainfrom
fix/mcp-vision-schema-and-genkit-cap
Nov 10, 2026
Merged

ghchinoy merged 2 commits into
mainfrom
fix/mcp-vision-schema-and-genkit-cap

Conversation

@jigyasujuneja

@jigyasujuneja jigyasujuneja commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Resolves two focused platform and static-analysis findings without touching files owned by in-flight PR #47:

  1. MCP vision tool schemas on local-only servers (Closes MCP: locate_bounding_boxes backend description names unavailable backends on local-only servers #33):

    • Updates visionBackendChoicesSchema (cmd/mcp_schema.go) so when configuredVisionBackends() is empty (dgem mcp --local / dgem serve --local, where local has no SigLIP vision tower), properties.backend keeps no enum (empty enum is invalid for Gemini) and sets its description to "No vision-capable backend on this server ('local' has no vision tower); this tool returns an error." instead of retaining the static struct-tag description advertising 'vertex_first', 'vertex', and 'cloudrun'.
    • Adds visionToolDescription on locate_bounding_boxes and locate_object (cmd/mcp.go) so MCP clients see "Unavailable on this server ('local' has no vision tower). ..." in tools/list on local-only servers, while leaving multi-backend tool descriptions unchanged.
    • Extends TestMCPBackendSchemaListsOnlyConfiguredBackends (cmd/mcp_backend_schema_test.go) to assert both locate_bounding_boxes and locate_object omit enum, omit 'vertex_first' / 'vertex' / 'cloudrun' from backend.description, and surface the unavailability prefix on local-only servers.
  2. Genkit mergeDependsOn allocation hygiene (CodeQL feat(templates): add retail catalog QA, 32-way taxonomy, and merchandising policies #26 / docs: fix broken anchors in batch and architecture docs #27):

    • Removes the len(deps)+len(askIf) map capacity expression (and unguarded len(askIf) slice preallocation) in mergeDependsOn (examples/dgemgenkit/bridge.go) so untrusted template JSON cannot trigger go/allocation-size-overflow or oversized initial allocations.
    • Adds TestMergeDependsOnDeduplicatesAndPreservesOrder (examples/dgemgenkit/bridge_test.go) covering large dependency lists, deduplication across deps and askIf, and deterministic sorted askIf ordering.

Verification

  • go vet ./... and go test -race ./cmd/... ./pkg/...
  • go -C examples vet ./... and go -C examples test -race ./...

Comment thread examples/dgemgenkit/bridge.go Fixed
Comment thread examples/dgemgenkit/bridge.go Fixed
@jigyasujuneja jigyasujuneja changed the title fix(mcp,genkit): clear unavailable vision backend hints on local servers and clamp mergeDependsOn map capacity fix(mcp,genkit): clear unavailable vision backend hints on local servers and remove computed allocation size in mergeDependsOn Nov 10, 2026
@ghchinoy

Copy link
Copy Markdown
Collaborator

Reviewed d82ac22 — dropping the make(...) capacity arithmetic in mergeDependsOn (examples/dgemgenkit/bridge.go) cleanly resolved the CodeQL go/allocation-size-overflow check, and the local-only MCP vision schema & description updates for #33 (cmd/mcp_schema.go, cmd/mcp.go, cmd/mcp_backend_schema_test.go) look clean and well-tested (11/11 checks green). Ready to merge!

@ghchinoy
ghchinoy merged commit 9ba4187 into main Nov 10, 2026
16 checks passed
@ghchinoy
ghchinoy deleted the fix/mcp-vision-schema-and-genkit-cap branch November 10, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: locate_bounding_boxes backend description names unavailable backends on local-only servers

3 participants