Skip to content

listmodels tool fails due to unexpected reason parameter from AI agents #376

@ricatix

Description

@ricatix

Project Version

9.8.2

Bug Description

Symptom: When calling the listmodels tool through modern AI agents (like Claude Code or Gemini), the tool fails with a schema validation error and returns no results. Error Message: Input validation error: Additional properties are not allowed ('reason' was unexpected).

Root Cause: Many AI agents automatically inject a reason parameter into tool calls to provide context for the action. However, the ListModelsTool has a strictly defined input schema in tools/listmodels.py:

def get_input_schema(self) -> dict[str, Any]:
    return {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": False,  # This caused the failure
    }

Because additionalProperties is set to False, the injection of the reason field (or any other metadata from the agent) causes the entire tool execution to be rejected before it even runs.

Expected Behavior: The tool should ignore unexpected top-level properties like reason to maintain compatibility with various AI agent implementations, or explicitly allow additionalProperties.

Suggested Fix: Change "additionalProperties": False to True in tools/listmodels.py.

Relevant Log Output

Operating System

macOS

Sanity Checks

  • I have searched the existing issues and this is not a duplicate.
  • I am using GEMINI_API_KEY
  • I am using OPENAI_API_KEY
  • I am using OPENROUTER_API_KEY
  • I am using CUSTOM_API_URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions