Skip to content

create/update tools fail for collections with point fields #15287

@SebastianSchuetze

Description

@SebastianSchuetze

Describe the Bug

When using plugin-mcp with a collection that contains a point field (geolocation), enabling MCP create/update for that collection causes MCP tool schema generation/translation to fail for OpenAI-compatible tool calling.

In VS Code Copilot Chat (MCP integration), the request fails with a 400 error because the function parameter schema is an array/tuple instead of an object:

Request Failed: 400 {"error":{"message":"Invalid schema for function '...createCities': [{'type': 'number'}, {'type': 'number'}] is not of type 'object', 'boolean'.","code":"invalid_request_body"}}

This matches how Payload represents point values in data: e.g. coordinates: [41.0082, 28.9784] (a 2-number tuple). find tools work, but any generated createX / updateX tool that includes a point field causes schema incompatibility with OpenAI tool parameters requirements (must be a JSON Schema object).

Link to the code that reproduces this issue

https://github.com/findmydoc-platform/website/blob/7498b148e0650e4b32d1dcc683667a0bbaa5f78d/src/collections/Cities.ts#L42

Reproduction Steps

  1. Create a new Payload v3 project:
    • pnpx create-payload-app@latest -t blank
  2. Configure Postgres (any local Postgres is fine) and set DATABASE_URI.
  3. Install and enable MCP plugin:
    • pnpm add @payloadcms/plugin-mcp
  4. Add a collection (e.g. cities) containing a point. field:
    • Example field: coordinates with type: 'point' and required: true.
  5. Configure the mcp plugin to expose the collection as writable (create/update enabled). (Exact config may vary, but the key is: the tool for createCities / updateCities gets generated.)
  6. Start the server (Next.js node runtime):
    • pnpm dev
  7. Connect via an MCP client that routes tool definitions through OpenAI function calling schema validation (e.g., VS Code Copilot Chat MCP).
  8. Observe failure during tool registration / invocation with an error like:
    • Invalid schema for function 'createCities': [{'type':'number'}, {'type':'number'}] is not of type 'object', 'boolean'.

Expected:

  • Tools should register successfully and createCities / updateCities should accept a valid schema for a point field. (either as { latitude: number, longitude: number } or an array nested under an object property) without violating OpenAI tool parameter requirements.

Observed:

  • Tool schema is rejected because the generated/translated parameters schema is an array/tuple rather than an object.

Which area(s) are affected?

plugin: mcp

Environment Info

Binaries:
  Node: 25.3.0
  npm: 11.7.0
  Yarn: N/A
  pnpm: 10.12.3
Relevant Packages:
  payload: 3.70.0
  next: 15.5.9
  @payloadcms/db-postgres: 3.70.0
  @payloadcms/drizzle: 3.70.0
  @payloadcms/email-nodemailer: 3.70.0
  @payloadcms/graphql: 3.70.0
  @payloadcms/live-preview: 3.70.0
  @payloadcms/live-preview-react: 3.70.0
  @payloadcms/next/utilities: 3.70.0
  @payloadcms/payload-cloud: 3.70.0
  @payloadcms/plugin-cloud-storage: 3.70.0
  @payloadcms/plugin-form-builder: 3.70.0
  @payloadcms/plugin-import-export: 3.70.0
  @payloadcms/plugin-mcp: 3.70.0
  @payloadcms/plugin-nested-docs: 3.70.0
  @payloadcms/plugin-redirects: 3.70.0
  @payloadcms/plugin-search: 3.70.0
  @payloadcms/plugin-seo: 3.70.0
  @payloadcms/richtext-lexical: 3.70.0
  @payloadcms/storage-s3: 3.70.0
  @payloadcms/translations: 3.70.0
  @payloadcms/ui/shared: 3.70.0
  react: 19.2.3
  react-dom: 19.2.3
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0 (macOS)
  Available memory (MB): 24576
  Available CPU cores: 14

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions