Skip to content

fix(mcpserver): coerce JSON float64 ints to int64 for shortcut tool args#33

Merged
zer0stars merged 1 commit into
mainfrom
fix/shortcut-int-coerce
Apr 20, 2026
Merged

fix(mcpserver): coerce JSON float64 ints to int64 for shortcut tool args#33
zer0stars merged 1 commit into
mainfrom
fix/shortcut-int-coerce

Conversation

@zer0stars

Copy link
Copy Markdown
Member

Summary

  • Fixes `float64 is not an int` failures on every MCP shortcut tool that takes an integer arg (e.g. `identity_get_vehicle` with `tokenId: 3`).
  • MCP SDK JSON-decodes number args into `float64` inside `map[string]any`; gqlgen's `Int!` scalar unmarshaller rejects `float64`.
  • Coerce arg values to `int64` in `registerShortcutTools` based on `ArgDefinition.Type == "integer"`, recursing into array items when `ItemsType == "integer"`.

Test plan

  • Added `TestCoerceArgTypes` + `TestCoerceArgTypesPreservesExistingInts`
  • `go test ./...` green
  • `make lint` green
  • Cascade dep bump to identity-api / telemetry-api / fetch-api after merge + tag

MCP SDK JSON-decodes number args to float64 in map[string]any. gqlgen's
Int! scalar unmarshaller rejects float64 with "float64 is not an int",
breaking every shortcut tool that takes an integer argument (e.g.
identity_get_vehicle with tokenId).

Coerce arg values to int64 when ArgDefinition.Type is "integer", and
recurse into array items when ItemsType is "integer".
@zer0stars
zer0stars merged commit 8cb3e0d into main Apr 20, 2026
4 checks passed
@zer0stars
zer0stars deleted the fix/shortcut-int-coerce branch April 20, 2026 18:53
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.

1 participant