Skip to content

iot__find_assets_by_sensors: unreachable error guard returns an opaque schema failure #645

Open

Description

@DhavalRepo18

What happens

A model that calls iot__find_assets_by_sensors without the sensors argument
gets back:

╭─ ✗ ToolResult │ assetops │ iot__find_assets_by_sensors ──╮
│ Tool arguments are not valid                             │
╰──────────────────────────────────────────────────────────╯

No field name, no hint at what was wrong. With nothing to act on, the model
retries the same call.

Why

src/servers/iot/main.py:502 declares sensors as required:

def find_assets_by_sensors(
    site_name: str,
    sensors: List[str],          # no default, so required
    match: str = "all",
    ...

Thirty-three lines below, at :535, the function already contains the right
response for an omitted value:

if not sensors:
    return ErrorResult(error="provide at least one sensor name")

That line can never run. Because sensors is required, pydantic rejects the
call during schema validation, before the function body executes, so the
framework's generic message is returned instead of the specific one the author
wrote.

Evidence

From a 315-trial TSFM sweep (7 models, 2 independently built runtime images,
15 scenarios, k=3): 155 calls to this tool supplied sensors and 5 omitted it.
Those 5 omissions produced 16 hard failures, because a model that receives
no usable message retries. Across all nine runs on the aa_v1 and TSFM
leaderboards this tool accounts for 17 of 48 occurrences of
Tool arguments are not valid, the largest single share of any tool.

No other tool on any server hard-failed in that sweep apart from two
iot__assets calls, which have a different and still undiagnosed cause.

Proposed fix

Two lines. Give sensors a default so the call reaches the body and the
existing guard fires:

    sensors: Optional[List[str]] = None,

and mark it required in the docstring, since the JSON schema loses that signal:

        sensors: Required. Sensor names, or fragments when `substring` is true.

Optional is already imported at :4, and history() at :729 in the same
file already uses exactly sensors: Optional[List[str]] = None, so this matches
local precedent.

Tradeoff

sensors leaves the schema's required array, so a well-behaved model loses
that cue and the docstring word carries it instead. The alternative, leaving the
signature alone and having the MCP layer append pydantic's validation detail to
its own message, is a wider change in the agent harness rather than two lines in
one server.

Activity

  1. github-actions commented on Nov 16, 2026

    @github-actions

    This issue has been inactive for 30 days. It will be closed in 7 days unless there is further activity.

  2. xtong629 commented on Nov 19, 2026

    @xtong629

    I opened #691 for this: it gives sensors a default of None and marks it as required in the docstring, so an omitted value reaches the existing "provide at least one sensor name" error. It includes tests for the omitted, null and empty-list cases and for the tool schema.

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