Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

@mattpodwysocki mattpodwysocki commented Oct 27, 2025

Description

Problem: When using OpenAI models (GPT-4, GPT-3.5, o1, o1-mini) in Cursor,
the create_style_tool and update_style_tool failed with
[invalid_argument] errors. These same tools worked fine in VS Code and
with Claude in Cursor.

Root Cause: Cursor's OpenAI integration cannot handle Zod schemas with
.passthrough(), which allows arbitrary additional properties. The create
and update style tools used .passthrough() to accept the full Mapbox Style
Specification without explicitly defining all 18+ fields.

Solution: Simplified the input schemas to remove .passthrough() and use
z.record(z.any()) instead:

Before:

  // Complex schema with .passthrough() - breaks Cursor + OpenAI
  const schema = z.object({
    name: z.string(),
    version: z.literal(8),
    sources: z.record(z.any()).optional(),
    layers: z.array(z.any()).optional()
  }).passthrough()

After:

  // Simple schema with generic object - works everywhere
  const schema = z.object({
    name: z.string(),
    style: z.record(z.any()).describe('Complete Mapbox Style Specification
  object')
  })

Testing

Before applied fix
Screenshot 2025-10-27 at 16 38 54

After applied fix
Screenshot 2025-10-27 at 16 38 42

All other clients are unaffected by this change.


Checklist

  • Code has been tested locally
  • Unit tests have been added or updated
  • Documentation has been updated if needed

Additional Notes

@mattpodwysocki mattpodwysocki requested a review from a team as a code owner October 27, 2025 20:40
Copy link
Member

@zmofei zmofei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, looks good to me, thanks for the update!

@mattpodwysocki mattpodwysocki merged commit 13418a5 into main Oct 28, 2025
1 check passed
@mattpodwysocki mattpodwysocki deleted the devkit_resources branch October 28, 2025 13:39
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.

3 participants