Skip to content

vllm.entrypoints.mcp.tool_server

Classes:

ToolServer

Bases: ABC

Methods:

Source code in vllm/entrypoints/mcp/tool_server.py
class ToolServer(ABC):
    @abstractmethod
    def has_tool(self, tool_name: str) -> bool:
        """
        Return True if the tool is supported, False otherwise.
        """
        pass

    @abstractmethod
    def get_tool_description(
        self, tool_name: str, allowed_tools: list[str] | None = None
    ) -> ToolNamespaceConfig | None:
        """
        Return the tool description for the given tool name.
        If the tool is not supported, return None.
        """
        pass

    @abstractmethod
    def new_session(
        self, tool_name: str, session_id: str, headers: dict[str, str] | None = None
    ) -> AbstractAsyncContextManager[Any]:
        """
        Create a session for the tool.
        """
        ...

get_tool_description(tool_name, allowed_tools=None) abstractmethod

Return the tool description for the given tool name. If the tool is not supported, return None.

Source code in vllm/entrypoints/mcp/tool_server.py
@abstractmethod
def get_tool_description(
    self, tool_name: str, allowed_tools: list[str] | None = None
) -> ToolNamespaceConfig | None:
    """
    Return the tool description for the given tool name.
    If the tool is not supported, return None.
    """
    pass

has_tool(tool_name) abstractmethod

Return True if the tool is supported, False otherwise.

Source code in vllm/entrypoints/mcp/tool_server.py
@abstractmethod
def has_tool(self, tool_name: str) -> bool:
    """
    Return True if the tool is supported, False otherwise.
    """
    pass

new_session(tool_name, session_id, headers=None) abstractmethod

Create a session for the tool.

Source code in vllm/entrypoints/mcp/tool_server.py
@abstractmethod
def new_session(
    self, tool_name: str, session_id: str, headers: dict[str, str] | None = None
) -> AbstractAsyncContextManager[Any]:
    """
    Create a session for the tool.
    """
    ...