Skip to content

z.object({}) missing .passthrough() in published npm package (v1.0.14) — dynamic properties silently stripped #28

Description

@antoine-marco

Problem

The published npm package (@cognitionai/metabase-mcp-server@1.0.14) has z.object({}) without .passthrough() on dynamic parameters like
dataset_query, visualization_settings, updates, parameters, etc.

Without .passthrough(), Zod silently strips all properties not explicitly declared in the schema. This means objects arrive as {} at
the handler, causing Metabase API to return 400/500 errors.

Current state

  • Source code (GitHub main branch, v2.2.0): Already fixed — .passthrough() is present on all dynamic z.object({}) schemas.
  • Published npm package (v1.0.14): Still broken — many z.object({}) are missing .passthrough().

Affected schemas in npm v1.0.14

card-tools.js:

  • dataset_query: z.object({}).optional() — should be z.object({}).passthrough().optional()
  • updates: z.object({}).describe(...) — missing .passthrough()
  • parameters: z.object({}).optional() (execute_card, execute_pivot) — missing .passthrough()

dashboard-tools.js:

  • parameters: z.array(z.object({})) — should be z.array(z.object({}).passthrough())
  • parameter_mappings: z.array(z.object({})) — missing .passthrough()
  • series: z.array(z.object({})) — missing .passthrough()
  • dashboard: z.object({}) (save_dashboard, save_dashboard_to_collection) — missing .passthrough()
  • embedding_params: z.object({}) — missing .passthrough()

database-tools.js:

  • schedules: z.object({}).optional() (create + update) — missing .passthrough()
  • details: z.object({}).optional() (update_database) — missing .passthrough()

table-tools.js:

  • updates: z.object({}).describe(...) (update_table + update_tables) — missing .passthrough()

Broken tools (with npm v1.0.14)

  • create_card — cannot create questions (dataset_query stripped)
  • update_card — cannot modify questions (updates stripped)
  • execute_card / execute_pivot_card_query — parameters stripped
  • create_dashboard / update_dashboard — parameters stripped
  • add_card_to_dashboard — parameter_mappings/series stripped
  • update_dashboard_cards — card configs stripped
  • save_dashboard / save_dashboard_to_collection — dashboard object stripped
  • update_database / create_database — schedules/details stripped
  • update_table / update_tables — updates stripped

Request

Please publish the current main branch (v2.2.0) to npm. The fix is already in the source code but npm users are stuck on the broken
v1.0.14.

Thank you for your work :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions