Skip to content

Calling McpServer::tool in unit tests returns undefined method #73

@tiagoraposeiraff

Description

@tiagoraposeiraff

Laravel Package Version

0.1.1

Laravel Version

11.44.2

PHP Version

8.3.7

Database Driver & Version

No response

Description

I have the following unit test:

public function test_health_status_tool_returns_ok(): void
{
        $response = PartnerApiServer::tool(HealthStatusTool::class, []);

        $response
            ->assertOk()
            ->assertSee('OK');
}

When exexuted, I get the following error:
Image

After checking the source code in /laravel/mcp/src/Server.php I cannot, in fact, find this method.
Is this just a matter of outdated documentation or is there's something else I'm missing?

The MCP itself is working and already in use by Cursor.

Steps To Reproduce

  • Install Laravel MCP
  • Add a new MCP Server
  • Create a tool under that MCP Server
  • Try to test it using the following syntax:
public function test_your_tool_returns_ok(): void
{
        $response = YourMcpServer::tool(YourTool::class, []);

        $response
            ->assertOk()
            ->assertSee('OK');
}

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