Skip to content

fix: filter MCP-specific fields from database creation requests#59

Merged
StuMason merged 1 commit intomainfrom
bug/create-db-validation
Jan 7, 2026
Merged

fix: filter MCP-specific fields from database creation requests#59
StuMason merged 1 commit intomainfrom
bug/create-db-validation

Conversation

@StuMason
Copy link
Owner

@StuMason StuMason commented Jan 7, 2026

Problem

The database MCP tool was returning Error: Validation failed. when trying to create databases, even with all required parameters provided.

Root Cause

The tool was passing ALL parameters to the Coolify API, including MCP-specific fields (action, type, uuid, delete_volumes). The Coolify API validation rejected these extra fields.

Solution

Extract MCP-specific fields before passing data to the API:

const { action, type, uuid, delete_volumes, ...dbData } = args;
return wrap(() => dbMethods[type](dbData));

Now only database-specific fields are sent to the API.

Testing

  • ✅ All existing tests pass
  • ✅ Build succeeds
  • ✅ Pre-commit hooks (lint + format) pass

Closes

Fixes #58

The database tool was passing all parameters including 'action', 'type',
'uuid', and 'delete_volumes' to the Coolify API, causing validation
errors. The API only expects database-specific fields.

This fix extracts MCP-specific fields and only passes the relevant
database configuration to the API.

Fixes #58
@codecov
Copy link

codecov bot commented Jan 7, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@claude
Copy link

claude bot commented Jan 7, 2026

Code Review for PR #59

Summary

This PR fixes a validation error when creating databases via the database MCP tool. The root cause was correctly identified: MCP-specific fields (action, type, uuid, delete_volumes) were being passed to the Coolify API, which rejected them.

✅ What Looks Good

  1. Correct Fix: The destructuring approach properly separates MCP control fields from database-specific data:

    const { action, type, uuid, delete_volumes, ...dbData } = args;
  2. Clean Implementation: The fix is minimal and targeted - only changes what needs to change.

  3. Consistent with Delete Action: The delete_volumes variable is now properly used in the delete case instead of accessing args.delete_volumes, which is cleaner and more consistent.

⚠️ Potential Issues to Consider

  1. Similar Pattern in Other Tools: I noticed the service tool at lines 464-488 may have a similar issue:

    • In createService(args as any) (line 475), the full args object is passed, which includes action, uuid, and delete_volumes
    • In updateService(uuid, args) (line 479), the full args is also passed with MCP fields

    If the Coolify API is strict about extra fields for services too, this could cause the same validation error. Consider applying the same fix pattern there.

  2. Application Tool: Similarly, the application tool (lines 281-331) passes args as any to createApplicationPrivateGH and createApplicationPrivateKey, and passes args to updateApplication. These may also have extra MCP fields.

🔍 Test Coverage

The existing tests verify client method existence but there are no integration-level tests that would catch this specific validation issue (passing extra fields). This is understandable given the architecture (client methods are tested separately), but a note in the PR description confirms manual testing was done.

💡 Suggestions

  1. Follow-up Issue: Consider opening a follow-up issue to audit and fix the service and application tools for the same MCP field leakage problem.

  2. Optional Enhancement: If this pattern needs to be applied in multiple places, a helper function could standardize the field filtering:

    const extractDbData = ({ action, type, uuid, delete_volumes, ...data }) => data;

Verdict

LGTM with minor concern 👍

The fix correctly solves the reported issue (#58). The code is clean and follows the existing patterns. The only concern is that similar bugs may exist in the service and application tools - recommend auditing those in a follow-up.


🤖 Review generated by Claude Code

@StuMason StuMason merged commit 283ec9c into main Jan 7, 2026
7 checks passed
@StuMason StuMason deleted the bug/create-db-validation branch January 7, 2026 13:44
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.

Bug: database tool validation fails with 'Validation failed' error

1 participant