Skip to content

Statamic-entries update fails SVG MIME validation for asset paths returned by get #41

Description

@florianbouvot

Tool Name

statamic-entries — action: update

Tool Input/Parameters

{
  "action": "update",
  "collection": "pages",
  "id": "home",
  "site": "default",
  "data": {
    "page_builder": [
      {
        "id": "home-missions",
        "type": "icon_cards",
        "enabled": true,
        "cards": [
          {
            "id": "mission-support",
            "type": "card",
            "enabled": true,
            "icon": "icons/heart.svg",
            "title": "Accompagner"
          }
        ]
      }
    ]
  }
}

Error Output

{
  "success": false,
  "errors": [
    "The page_builder cards icon field must be a file of type: svg."
  ]
}
The exact validation path depends on the block position in the complete
page_builder payload. Replacing "icons/heart.svg" with
"assets::icons/heart.svg" makes the same update succeed.

Expected Output

The update should succeed when an asset value returned by
statamic-entries get is sent back unchanged to statamic-entries update.

Asset values should be round-trip safe. The MCP should either return the
canonical Statamic asset ID ("assets::icons/heart.svg") or normalize the
relative path before MIME validation.

Tool Category

Entry Tools

Statamic State

No response

Relevant Logs

- Statamic: 6.31.0
- cboxdk/statamic-mcp: 2.9.0
- Site: default, locale fr
- Collection: pages
- Entry: home
- Asset container: assets
- Field location: page_builder > icon_cards > cards > icon
- Field type: assets
- Container: assets
- Folder: icons
- max_files: 1
- Validation: required, mimes:svg

The asset endpoint confirms that the file is a valid SVG:

{
  "id": "assets::icons/heart.svg",
  "path": "icons/heart.svg",
  "extension": "svg",
  "mime_type": "image/svg+xml",
  "is_image": false,
  "width": 24,
  "height": 24
}

statamic-entries get returns the relative path "icons/heart.svg", while
the update validation only succeeds with the canonical ID
"assets::icons/heart.svg".

No server exception or relevant log entry was generated. The failure is
returned directly by the MCP tool as a field validation error.

Frequency

Always (100% reproducible)

Debugging Steps Taken

  • Cleared Statamic cache (php artisan statamic:stache:clear)
  • Cleared Laravel cache (php artisan cache:clear)
  • Checked file permissions
  • Verified tool works with different parameters
  • Tested in fresh Statamic installation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions