Skip to content

[Server] Schema not removed after injecting SessionInterface #168

@lvluoyue

Description

@lvluoyue

Describe the bug
I noticed that $_session can be injected in tools, but it requires entering a session in the inspector. However, after entering it, it doesn't get overridden, but rather becomes SessionInterface.

To Reproduce

<?php

namespace app\mcp;

use Mcp\Capability\Attribute\McpTool;
use Mcp\Server\Session\SessionInterface;

class example
{
    #[McpTool(name: 'example_tool')]
    public function exampleTool(SessionInterface $_session): array
    {
        return [
            'status' => 'ok',
            'session_id' => $_session->getId()->toRfc4122(),
        ];
    }
}

Expected behavior
Support SessionInterface injection and remove related schema

Additional context

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingServerIssues & PRs related to the Server component

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions