fix(slack): use z.coerce.string() for timestamp fields to handle LLM numeric inputs#116
fix(slack): use z.coerce.string() for timestamp fields to handle LLM numeric inputs#116blinkagent[bot] wants to merge 1 commit intomainfrom
Conversation
…numeric inputs LLMs sometimes pass Slack timestamps as numbers instead of strings (e.g., 1234567890.123456 instead of "1234567890.123456"). The Slack API requires these to be strings, and without coercion, Zod validation would reject numeric timestamps causing slack_sendMessage and related tools to fail. This change uses z.coerce.string() for all timestamp fields (ts, thread_ts) to automatically convert numbers to strings, making the tools more robust to LLM output variations. Affected tools: - sendMessage (ts field) - reactToMessage (ts field) - readMessage (ts field) - readThreadReplies (ts field) - reportStatus (thread_ts field)
CI Failure AnalysisThe CI typecheck failures are not caused by my changes. They appear to be related to a dependency resolution issue in the CI environment. Evidence:
Root CauseThe CI is using RecommendationThis CI failure affects all PRs, not just this one. The repo may need to:
|
Problem
LLMs sometimes pass Slack timestamps as numbers instead of strings (e.g.,
1234567890.123456instead of"1234567890.123456"). The Slack API requires these to be strings, and without coercion, Zod validation would reject numeric timestamps causingslack_sendMessageand related tools to fail with type validation errors.Solution
This change uses
z.coerce.string()instead ofz.string()for all timestamp fields (ts,thread_ts) to automatically convert numbers to strings, making the tools more robust to LLM output variations.Affected tools
sendMessage(ts field)reactToMessage(ts field)readMessage(ts field)readThreadReplies(ts field)reportStatus(thread_ts field)Related
This is a known issue with Slack's API - see:
thread_tsmust be a string not a float slackapi/node-slack-sdk#780