Skip to content

datarobot_genai.drmcputils.categories

categories

Pre-defined MCP tool categories for header-based filtering.

Categories allow agents and the DR platform to request logical groups of tools via the x-datarobot-mcp-tools header instead of enumerating individual tool names. Parents expand to all their leaf children; leaves expand to the set of tool function names they contain. Anything that does not match a known category is kept as-is (treated as a plain tool name).

Hierarchy

dr_connectors dr_connector_confluence dr_connector_jira dr_connector_gdrive dr_connector_microsoft_sharepoint_onedrive dr_web_search dr_web_search_perplexity dr_web_search_tavily dr_documentation (leaf — no sub-categories) dr_use_cases (leaf — no sub-categories) dr_predictive dr_catalog dr_modeling dr_predictions dr_deployments (leaf — no sub-categories) dr_development dr_workload dr_file dr_visual dr_mcpapps dr_panels dr_db dr_vdb dr_proxied_user_mcp (global-mcp only — proxied user MCPs) dr_dynamic_tools (hosted tools — registered separately)

resolve_to_tool_names

resolve_to_tool_names(entries: frozenset[str]) -> frozenset[str]

Expand category names in entries to their constituent tool names.

Resolution rules (applied per entry): 1. Parent category → expand to all leaf categories → expand each to tool names 2. Leaf category → expand to its tool names 3. Anything else → kept as-is (treated as a plain tool name)

Unknown entries (typos, future categories) are silently kept as plain strings. They will simply never match any registered tool name and the filter will ignore them — no error is raised.

Parameters:

Name Type Description Default
entries frozenset[str]

Raw strings parsed from the x-datarobot-mcp-tools header.

required
Returns
Resolved set of tool function names (plain strings only).
Source code in datarobot_genai/drmcputils/categories.py
def resolve_to_tool_names(entries: frozenset[str]) -> frozenset[str]:
    """Expand category names in *entries* to their constituent tool names.

    Resolution rules (applied per entry):
    1. Parent category  → expand to all leaf categories → expand each to tool names
    2. Leaf category    → expand to its tool names
    3. Anything else    → kept as-is (treated as a plain tool name)

    Unknown entries (typos, future categories) are silently kept as plain
    strings.  They will simply never match any registered tool name and the
    filter will ignore them — no error is raised.

    Args:
        entries: Raw strings parsed from the ``x-datarobot-mcp-tools`` header.

    Returns
    -------
        Resolved set of tool function names (plain strings only).
    """
    resolved: set[str] = set()
    for entry in entries:
        if entry in PARENT_TO_CHILDREN:
            # Parent → expand each leaf child to tool names
            for leaf in PARENT_TO_CHILDREN[entry]:
                resolved.update(LEAF_CATEGORY_TOOLS.get(leaf, frozenset()))
        elif entry in LEAF_CATEGORY_TOOLS:
            # Leaf → expand to tool names
            resolved.update(LEAF_CATEGORY_TOOLS[entry])
        else:
            # Plain tool name or unknown category — pass through
            resolved.add(entry)
    return frozenset(resolved)

parse_tool_allowlist_header

parse_tool_allowlist_header(raw: str | None) -> frozenset[str] | None

Parse the x-datarobot-mcp-tools header and resolve any category names.

Category names (e.g. dr_connectors, dr_connector_jira) are expanded to the set of tool function names they contain. Plain tool names and unknown entries are kept as-is. Returns None when the header is absent or blank, meaning no tool filtering should be applied.

Source code in datarobot_genai/drmcputils/categories.py
def parse_tool_allowlist_header(raw: str | None) -> frozenset[str] | None:
    """Parse the x-datarobot-mcp-tools header and resolve any category names.

    Category names (e.g. ``dr_connectors``, ``dr_connector_jira``) are expanded
    to the set of tool function names they contain.  Plain tool names and unknown
    entries are kept as-is.  Returns None when the header is absent or blank,
    meaning no tool filtering should be applied.
    """
    entries = _parse_header_entries(raw)
    if entries is None:
        return None
    return resolve_to_tool_names(entries)

categories_for_tool

categories_for_tool(tool_name: str) -> list[str]

Return the sorted category labels (leaf + parent) for tool_name.

Empty list for hosted/dynamic tools and any name not in the static taxonomy.

Source code in datarobot_genai/drmcputils/categories.py
def categories_for_tool(tool_name: str) -> list[str]:
    """Return the sorted category labels (leaf + parent) for *tool_name*.

    Empty list for hosted/dynamic tools and any name not in the static taxonomy.
    """
    return sorted(TOOL_TO_CATEGORIES.get(tool_name, frozenset()))