Management: add slug/description/images/is_published to MCP inventory tools #26

Open
opened 2026-07-25 14:27:57 +00:00 by yuris · 0 comments
Owner

Problem

create_inventory_item and update_inventory_item MCP tools are missing the four store-facing fields (slug, description, images, is_published), making it impossible to publish items to the store catalog via MCP.

The server action and REST API already handle these fields correctly — only the MCP tool schemas are incomplete.

Target

apps/management/lib/mcp/tools/inventory.ts

Change

  • Add slug (optional string matching ^[a-z0-9]+(?:-[a-z0-9]+)*$), description (optional string | null), images (optional string[]), and is_published (optional boolean) to create_inventory_item.
  • Add the same four fields to update_inventory_item.
  • Wire them through to the Drizzle insert/update (mirror the pattern already used for item_name, type, etc.).
  • Use InventorySlugSchema from @/lib/db/validators for slug validation.
  • The DB constraint inventory_published_slug_check (not is_published OR slug IS NOT NULL) must be respected: if is_published: true is passed without a slug, the DB will reject it — surface a clear error rather than letting the Drizzle error bubble up raw.

Acceptance

  • Both tools accept all four fields.
  • Setting is_published: true without a slug returns a clear error message.
  • tsc --noEmit and biome check pass.
  • No other files changed.
## Problem `create_inventory_item` and `update_inventory_item` MCP tools are missing the four store-facing fields (`slug`, `description`, `images`, `is_published`), making it impossible to publish items to the store catalog via MCP. The server action and REST API already handle these fields correctly — only the MCP tool schemas are incomplete. ## Target `apps/management/lib/mcp/tools/inventory.ts` ## Change - Add `slug` (optional string matching `^[a-z0-9]+(?:-[a-z0-9]+)*$`), `description` (optional string | null), `images` (optional `string[]`), and `is_published` (optional boolean) to `create_inventory_item`. - Add the same four fields to `update_inventory_item`. - Wire them through to the Drizzle insert/update (mirror the pattern already used for `item_name`, `type`, etc.). - Use `InventorySlugSchema` from `@/lib/db/validators` for slug validation. - The DB constraint `inventory_published_slug_check` (`not is_published OR slug IS NOT NULL`) must be respected: if `is_published: true` is passed without a slug, the DB will reject it — surface a clear error rather than letting the Drizzle error bubble up raw. ## Acceptance - Both tools accept all four fields. - Setting `is_published: true` without a slug returns a clear error message. - `tsc --noEmit` and `biome check` pass. - No other files changed.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage#26
No description provided.