tools
Tools integration for Datalayer AI Agents using MCP (Model Context Protocol).
def generate_name_from_id(tool_id: str) -> str
Generate a display name from a tool ID.
Replaces underscores with spaces and capitalizes the first letter.
Args: tool_id: Tool identifier (e.g., "notebook_run-all-cells")
Returns: Formatted name (e.g., "Notebook run-all-cells")
def create_mcp_server(base_url: str, token: str | None = None) -> pydantic_ai.mcp.MCPServerStreamableHTTP
Create an MCP server connection to jupyter-mcp-server.
The jupyter-mcp-server runs on the same Jupyter server and exposes tools via the MCP protocol over HTTP.
Args: base_url: Jupyter server base URL (e.g., "http://localhost:8888") token: Authentication token for Jupyter server
Returns: MCPServerStreamableHTTP instance connected to jupyter-mcp-server
def get_available_tools_from_mcp(base_url: str, token: str | None = None) -> list[dict[str, typing.Any]]
Get available tools from jupyter-mcp-server via MCP protocol.
This replaces the previous jupyter-mcp-tools direct query approach. Now we connect to the MCP server using pydantic-ai's MCP client and query tools through the standard MCP protocol.
Args: base_url: Jupyter server base URL token: Authentication token for Jupyter server
Returns: List of tool dictionaries with name, description, and inputSchema
def get_available_tools(base_url: str, token: str | None = None, enabled_only: bool = True) -> list[dict[str, typing.Any]]
Get available tools (backward compatible wrapper).
Args: base_url: Jupyter server base URL token: Authentication token for Jupyter server enabled_only: Ignored (kept for backward compatibility)
Returns: List of tool dictionaries
def tools_to_builtin_list(tools: list[dict[str, typing.Any]]) -> list[str]
Extract tool names from tools list.
Args: tools: List of tool dictionaries
Returns: List of tool names/IDs