Skip to content

SmolAgentsAdapter fails on tools with no input parameters (missing properties field) #78

@lordmathis

Description

@lordmathis

The SmolAgentsAdapter.adapt() method crashes with a KeyError: 'properties' when processing MCP tools that have no input parameters.

Steps to Reproduce:

  1. Connect to an MCP server that has at least one tool with no input parameters (e.g., a tool that just returns server version)
  2. The tool's input schema will be valid JSON Schema: {"type": "object"}
  3. Try to load the tools via smolagents MCPClient

Expected Behavior:

Tools with no input parameters should be supported. A JSON Schema of {"type": "object"} without properties is valid and indicates no parameters are required.

Actual Behavior:

The adapter crashes at line 103 in smolagents_adapter.py:
for k, v in input_schema["properties"].items():

This line assumes properties always exists, which is not true for parameter-less tools.

I'd be happy to provide a fix, if confirmed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions