Commit Graph

2 Commits

Author SHA1 Message Date
czlonkowski
b0279bd11f fix: resolve 5 bugs in n8n_manage_datatable row operations and error handling
Fix critical issues found during staging QA testing:

1. data parameter serialization: MCP transport sends JSON as strings —
   added z.preprocess coercers (coerceJsonArray, coerceJsonObject,
   coerceJsonFilter) to parse string→JSON before Zod validation

2. filter/sortBy URL encoding: n8n API requires URL-encoded query params —
   added encodeURIComponent() for filter and sortBy in getRows/deleteRows

3. json column type: n8n API only accepts string|number|boolean|date —
   removed json from enum in types, Zod schema, tool definition, and docs

4. 404 error messages: N8nNotFoundError was wrapping API messages in
   "Resource with ID <message> not found" — now passes through cleanly

5. Unit test expectations updated for URL-encoded filter/sortBy values

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 22:03:07 +01:00
Romuald Członkowski
be3d07dbdc feat: add n8n_manage_datatable MCP tool with full CRUD (#640) (#650)
* feat: add n8n_create_data_table MCP tool and projectId for create workflow (#640)

Add new MCP tool to create n8n data tables via the REST API:
- n8n_create_data_table tool definition with name + columns schema
- handleCreateDataTable handler with Zod validation and N8nApiError handling
- N8nApiClient.createDataTable() calling POST /data-tables
- DataTable, DataTableColumn, DataTableColumnResponse types per OpenAPI spec
- Column types: string | number | boolean | date | json
- Input validation: .min(1) on table name and column names
- Tool documentation with examples, use cases, and pitfalls

Also adds projectId parameter to n8n_create_workflow for enterprise
project support, and fixes stale management tool count in health check.

Based on work by @djakielski in PR #646.
Co-Authored-By: Dominik Jakielski <dominik.jakielski@urlaubsguru.de>

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: replace n8n_create_data_table with n8n_manage_datatable (10 actions)

Replaces the single-purpose n8n_create_data_table tool with a comprehensive
n8n_manage_datatable tool covering all 10 n8n data table API endpoints:

Table operations: createTable, listTables, getTable, updateTable, deleteTable
Row operations: getRows, insertRows, updateRows, upsertRows, deleteRows

- Filter system with and/or logic and 8 condition operators
- Dry-run support for updateRows, upsertRows, deleteRows
- Pagination, sorting, and full-text search for row listing
- 9 new N8nApiClient methods for all data table endpoints
- Shared error handler and consolidated Zod schemas
- Comprehensive tool documentation with examples per action
- 36 handler tests + 18 API client tests

BREAKING: n8n_create_data_table removed. Use n8n_manage_datatable with
action="createTable" instead.

Based on work by @djakielski in PR #646.
Co-Authored-By: Dominik Jakielski <dominik.jakielski@urlaubsguru.de>

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2026-03-21 19:06:22 +01:00