Stu Mason · Folkestone, Kent
One entryMerged PR· StuMason/coolify-mcp· TypeScript

PR #240 merged: fix: accept destination_uuid on database create (#217)

additions
+62
deletions
-0
files changed
2

Summary

The database tool's create action didn't expose destination_uuid in its zod input schema, so Coolify rejects database creates on any server with more than one destination configured:

Server has multiple destinations. Please provide a destination_uuid.

The application tool already handles this correctly by exposing destination_uuid on its create schema. This PR mirrors that pattern for database.

What was already fine

  • CreateDatabaseBaseRequest in src/types/coolify.ts already had an optional destination_uuid field, inherited by all the per-engine create request types (CreatePostgresqlRequest, CreateMysqlRequest, etc.).
  • The client methods (createPostgresql, createMysql, createMariadb, createMongodb, createRedis, createKeydb, createClickhouse, createDragonfly) all just JSON.stringify the full request body, so they already forward destination_uuid if present.
  • docs/coolify-openapi.yaml documents destination_uuid on every /databases/{type} create endpoint ("UUID of the destination if the server has multiple destinations") — the spec is accurate here, unlike the staleness noted in #236.

The actual bug

Only the MCP tool schema in src/lib/mcp-server.ts was missing the field, so zod stripped it out of the tool call before it ever reached the client.

Fix

Added destination_uuid: z.string().optional() (with a description matching the OpenAPI wording) to the database tool's schema. Since the handler builds the request body via const { action, type, uuid, delete_volumes, ...dbData } = args and forwards dbData straight to whichever dbMethods[type] client call is selected, this single schema change covers all 8 create variants (postgresql, mysql, mariadb, mongodb, redis, keydb, clickhouse, dragonfly) — no handler changes needed.

Test plan

  • Added database tool handler describe block in src/__tests__/mcp-server.test.ts following the existing application tool handler pattern: asserts destination_uuid is forwarded to createPostgresql when provided, and omitted when not.
  • npm test — 365 passed
  • npm run lint — 0 errors (2 pre-existing no-explicit-any warnings, unrelated to this change)
  • npx prettier --check . — clean
  • npm run build — clean

Closes #217

🤖 Generated with Claude Code