Skip to content

McpTool without parameters fails execution #26

@marcod85

Description

@marcod85

Version: 3.0.0

If I define an McpTool which doesn't need any arguments, the Mcp call will fail upon execution.

e.g.

/*
 * Returns the types of something that are supported.
 *
 * @return list<array{type: string, long_name: string}>
 */
#[McpTool(name: 'supportedTypes')]
public function supportedTypes(): array
{
    return [
        [
            'type' => 'a',
            'long_name' => 'Alpha',
        ],
        [
            'type' => 'b',
            'long_name' => 'Beta',
        ]
    ];
}

Executing this tool results in the following error:

{"method":"tools/call","code":-32602,"message":"Invalid parameters for tool 'supportedTypes': Invalid type. Expected `object`, but received `unknown`.","data":{"validation_errors":[{"pointer":"/","keyword":"type","message":"Invalid type. Expected `object`, but received `unknown`."}]}}

in Version 2.x it worked

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