Skip to content

[Bug]: MCP Inspector error if generating an MCP tool without parameters #74

@Jefferson49

Description

@Jefferson49

What happened?

Observed with version 1.4.2 and PHP 8.3.14

I generated a MCP tool from an OpenApi.json file. The MCP tool has no parameter. It is a simple GET request with no input.

For the MCP tool, the following input schema was generated:

    public function inputSchema(): array
    {
        return [
            'type' => "object",
            'properties' => [],
            'required' => []
        ];
    }

If I test this tool with MCP Inspector, I get an error message.

If I change the input schema to return stdClass instead of an empty array, the error disappears.

 'properties' => new stdClass,

My question:
Is this behavior a defect in the MCP tool generation of laravel-mcp-server? Should it generate a different input schema (with stdClass)? Or is an defect in MCP Inspector?

How to reproduce the bug

  • Generate an MCP tool from an OpenAPI JSON file for an API request without a parameter.
  • Start dev server
  • Request the list of current MCP tools with MCP Inspector

Package Version

1.4.2

PHP Version

8.3.14

Laravel Version

Development test server on localhost. Started with: composer run dev

Which operating systems does this happen with?

Windows 10

Notes

No response

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