Skip to content

**Bug: Tool call arguments with integer schema are serialized as JSON strings** #483

Description

@gabrielgiersch-ai

Environment

  • FLM version: latest (tested via Jan 0.7.9 as OpenAI-compatible client)
  • OS: Windows 11
  • Hardware: ASUS ProArt PX13, AMD Ryzen AI 9 HX 370 (XDNA2 NPU)
  • Model: Qwen3.5 (2B / 9B)

Describe the bug

When FLM generates a tool call response, integer-typed parameters declared in the JSON schema are serialized as strings in the resulting JSON.

Example — tool schema declares start_order and end_order as integer, but FLM outputs:

{"end_order": "5", "file_id": "13c3b21d-...", "start_order": "0"}

Same issue with top_k / limit parameters:

{"limit": "6"}

This causes downstream consumers that enforce strict JSON types to fail:

invalid type: string "0", expected i64
invalid type: string "6", expected usize

Expected behavior

Tool call arguments should respect the JSON schema types declared by the tool definition:

{"end_order": 5, "file_id": "13c3b21d-...", "start_order": 0}
{"limit": 6}

Impact

Any application that uses FLM with tools expecting integer parameters will silently fail if the receiving end enforces strict types (Rust, typed APIs, etc.). Makes FLM incompatible with Jan's built-in RAG engine and likely other tools.

Steps to reproduce

  1. Configure a tool with integer-typed parameters in the JSON schema
  2. Send a prompt that triggers a tool call via FLM serve (port 52625)
  3. Inspect the raw tool call arguments in the response
  4. Observe that integer values are wrapped in quotes

Note
I've reported the same issue to Jan (janhq/jan) as it affects their RAG integration, but the root cause is in FLM's serialization of tool call arguments.

Metadata

Metadata

Assignees

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