Skip to content

vllm.entrypoints.mcp.tool_server

ToolServer

Bases: ABC

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 abstractmethod

get_tool_description(
    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.

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 abstractmethod

has_tool(tool_name: str) -> bool

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 abstractmethod

new_session(
    tool_name: str,
    session_id: str,
    headers: dict[str, str] | None = None,
) -> AbstractAsyncContextManager[Any]

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.
    """
    ...