Skip to content

fix: JSON Schema passthrough, collection lifecycle, and dashboard tab management#24

Open
aniravi24 wants to merge 4 commits intoCognitionAI:mainfrom
aniravi24:fix/json-schema-passthrough
Open

fix: JSON Schema passthrough, collection lifecycle, and dashboard tab management#24
aniravi24 wants to merge 4 commits intoCognitionAI:mainfrom
aniravi24:fix/json-schema-passthrough

Conversation

@aniravi24
Copy link
Copy Markdown

@aniravi24 aniravi24 commented Feb 12, 2026

Summary

Multiple fixes for MCP tool compatibility and missing Metabase API coverage:

  • JSON Schema passthrough: z.unknown() produces empty JSON Schema {}, causing MCP clients to strip nested object properties. Replaced with z.record(z.string(), z.any()) / z.array(z.any()) for correct schema generation.
  • Collection lifecycle: delete_collection now archives before deleting (Metabase requires this). Added archived parameter to update_collection.
  • Dashboard move fix: Handle Metabase "Dashboard Questions" that have type: "question" with a non-null dashboard_id — these should not be moved via collection API.
  • Dashboard tab management: Added tabs parameter to update_dashboard_cards tool. Pass [] to remove all tabs, or an array of tab objects to set specific tabs.

Commits

  1. fix: replace z.unknown() with z.any()/z.record() — JSON Schema generation fix
  2. fix: handle Metabase Dashboard Questions in move operations — prevent errors on dashboard-scoped questions
  3. fix: add archived param to update_collection, fix delete_collection — collection archive-before-delete
  4. feat: add tabs parameter to update_dashboard_cards tool — dashboard tab management

Test plan

  • dataset_query passthrough works when creating/updating cards via MCP
  • delete_collection successfully archives then deletes (tested on Metabase v0.57)
  • update_collection with archived: true works
  • update_dashboard_cards with tabs: [] removes all tabs
  • update_dashboard_cards with tab array preserves specified tabs and removes others

aniravi24 and others added 4 commits February 11, 2026 23:03
…ema generation

z.unknown() produces an empty JSON Schema `{}` which MCP clients
(like Claude Code) interpret as an empty object with no additional
properties allowed, causing all nested properties to be stripped
before reaching the server.

- dataset_query: z.unknown() → z.record(z.string(), z.any())
- data_authority: z.unknown() → z.record(z.string(), z.any())
- target arrays: z.array(z.unknown()) → z.array(z.any())
- parameter value: z.unknown() → z.any()

This produces explicit JSON Schema with additionalProperties
that MCP clients correctly preserve.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Metabase v0.57+ "Dashboard Questions" (cards created directly on a
dashboard) have dashboard_id set and cannot have collection_id changed
via the bulk move endpoints. This caused 400 errors when trying to
move these cards to collections.

Fixes:
- move_to_collection: send dashboard_id=null for cards so Dashboard
  Questions are detached before the collection move
- moveCards(): fix falsy check (if collectionId) that would skip
  collection_id=0 (root); add fallback to individual PUT calls when
  the bulk endpoint rejects Dashboard Questions
- moveCardsToCollection(): same Dashboard Question fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- update_collection now exposes `archived` boolean for archiving/unarchiving
- delete_collection archives first then deletes (Metabase requires trash before delete)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allows managing dashboard tabs through the MCP. Pass tabs array to
override tabs (use [] to remove all tabs), or omit to preserve existing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aniravi24 aniravi24 changed the title fix: replace z.unknown() with z.any()/z.record() for correct JSON Schema generation fix: JSON Schema passthrough, collection lifecycle, and dashboard tab management Feb 12, 2026
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.

1 participant