Skip to content

datarobot_genai.drmcpbase.routes.static

static

/static/* — rich tool metadata routes for user-mcp UIs.

Routes in the group
  • GET /static/tools/ — the full paginated tool catalog.
  • GET /static/categories/ — the category tree, with live per-node tool counts.
  • GET /static/providers/ — the tool-provider filter enum (value + label).

Each tools/ item carries required_scopes — the OAuth scopes a tools/call token must cover, combined across every declaration spelling and read with drmcpbase.oauth_scopes.declared_scopes_of_component, the same function the scope-validation middleware enforces with, so what is reported is what is enforced.

global-mcp and user-mcp both call register_static_routes from this module. Tool Sets remain global-mcp-only at /toolGallery/toolSets/*.

register_static_routes

register_static_routes(mcp: Any, base_path: str = STATIC_BASE_PATH, gate: StaticRouteGate | None = None, ui_metadata_provider: UiMetadataProvider | None = None, catalog_provider: CatalogProvider | None = None) -> None

Register every /static/* discovery route on the FastMCP server, all sharing gate.

Source code in datarobot_genai/drmcpbase/routes/static.py
def register_static_routes(
    mcp: Any,
    base_path: str = STATIC_BASE_PATH,
    gate: StaticRouteGate | None = None,
    ui_metadata_provider: UiMetadataProvider | None = None,
    catalog_provider: CatalogProvider | None = None,
) -> None:
    """Register every ``/static/*`` discovery route on the FastMCP server, all sharing *gate*."""
    prefix = base_path.rstrip("/")

    routes: list[tuple[str, Callable[[Request], Awaitable[JSONResponse]]]] = [
        ("/tools/", _make_tools_handler(mcp, ui_metadata_provider, catalog_provider)),
        ("/categories/", _make_categories_handler(mcp, catalog_provider)),
        ("/providers/", _providers_handler),
    ]
    for sub_path, handler in routes:
        register_gated_get(mcp, f"{prefix}{sub_path}", handler, gate)

    logger.info(
        "static routes registered under %s (%d route(s), gated=%s)",
        prefix,
        len(routes),
        gate is not None,
    )