Skip to content

create_link/update_link: data and tags fields cause 500 error, never persist (missing JSON stringification) #1

Description

@karero

Bug

create_link and update_link return an Internal Server Error whenever the request includes a data payload or tags array, and neither field is ever persisted -- even on calls where the error fires, other fields in the same request (e.g. title, subtitle) do still save correctly, so this isn't a total request failure, just these two fields.

Root cause (found in src/api-client.ts)

CreateLinkData/UpdateLinkData type data as Record<string, unknown> and tags as string[] (lines ~94-95, ~123-124), and the request body is stringified once as a whole:

...(body !== undefined ? { body: JSON.stringify(body) } : {}),

But per docs.grovs.io/docs/api-reference/generate-link, the underlying Grovs REST API expects data to be a stringified JSON string as its value (e.g. "data": "{\"screen\": \"promo\"}"), not a nested raw object. Stringifying the outer body once nests data as a raw object instead of double-encoding it as the API expects -- the MCP server is missing a JSON.stringify() pass on data (and apparently tags, which fails the same way) before it goes into the outer body.

Repro

Via the MCP tools directly:

  1. update_link with only title/subtitle → succeeds, both persist (confirmed via get_link).
  2. update_link with tags: ["referral"] alone → Internal Server Error; get_link afterward shows no tags field at all.
  3. update_link with data: {"referralCode": "some-code"} alone → Internal Server Error; get_link afterward shows no data field at all.
  4. name, title, subtitle, path, image_url all work individually and combined -- it's specifically data and tags that fail.

Suggested fix

Stringify data (and tags, if the REST API expects the same treatment there) individually before assembling the outer body, e.g.:

JSON.stringify({ ...rest, data: data ? JSON.stringify(data) : undefined })

Happy to help verify a fix against a real project if useful.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions