Claude sending invalid unit values to a set_alarm tool

CCDV-F Tools & MCP Easy Question 16 of 105

A set_alarm tool takes a unit parameter, typed in its input_schema as a plain string. In testing Claude sometimes sends secs or hr, and the server rejects the call.

Which change stops those invalid values at the source?

Show answer and explanation

BConstrain the unit property with an enum of seconds, minutes, and hours.

Anthropic tool schemas are JSON Schema, so an enum on the property restricts the value to the listed literals, the way the documented get_weather tool restricts unit to celsius or fahrenheit. Strict tool use guarantees that inputs match the schema, but a schema that says only 'string' still admits secs, so strict alone changes nothing here. A description is guidance the model may or may not follow, not a constraint the API enforces. And normalising on the server hides the problem instead of stopping it, and breaks the moment a new abbreviation appears.

Source: platform.claude.com/docs/en/agents-and-tools/tool-use/defin…

Anonymous, no account needed. Your tally stays in this browser.

Next question Start 5 timed questions Browse all 105 original CCDV-F practice questions