Skip to content

datarobot_genai.drmcpbase.dynamic_tools.deployment.config

config

Pure configuration assembly for DataRobot deployment tools.

All functions in this module are pure: they take explicit arguments and do not call request_user_dr_client or access any request context.

assemble_deployment_tool_config

assemble_deployment_tool_config(deployment: Deployment, metadata: MetadataBase, base_url: str, auth_headers: dict[str, str]) -> ExternalToolRegistrationConfig

Assemble an ExternalToolRegistrationConfig from pre-computed parts.

This is the pure counterpart to create_deployment_tool_config in drmcp. All expensive lookups (URL, auth, metadata) are done by the caller and passed in as plain arguments.

Parameters:

Name Type Description Default
deployment Deployment

The DataRobot deployment object.

required
metadata MetadataBase

Resolved MetadataBase adapter.

required
base_url str

Pre-computed prediction base URL.

required
auth_headers dict[str, str]

Pre-computed authentication headers.

required
Returns
ExternalToolRegistrationConfig ready for tool creation.
Source code in datarobot_genai/drmcpbase/dynamic_tools/deployment/config.py
def assemble_deployment_tool_config(
    deployment: dr.Deployment,
    metadata: MetadataBase,
    base_url: str,
    auth_headers: dict[str, str],
) -> ExternalToolRegistrationConfig:
    """Assemble an ExternalToolRegistrationConfig from pre-computed parts.

    This is the pure counterpart to create_deployment_tool_config in drmcp.
    All expensive lookups (URL, auth, metadata) are done by the caller and
    passed in as plain arguments.

    Args:
        deployment: The DataRobot deployment object.
        metadata: Resolved MetadataBase adapter.
        base_url: Pre-computed prediction base URL.
        auth_headers: Pre-computed authentication headers.

    Returns
    -------
        ExternalToolRegistrationConfig ready for tool creation.
    """
    merged_headers = {**auth_headers, **metadata.headers}
    endpoint = metadata.endpoint.lstrip("/")
    tool_name = _get_tool_name(deployment, metadata)
    tool_description = _get_tool_description(deployment, metadata)

    return ExternalToolRegistrationConfig(
        name=tool_name,
        title=deployment.label,
        description=tool_description,
        method=metadata.method,
        base_url=base_url,
        endpoint=endpoint,
        headers=merged_headers,
        input_schema=metadata.input_schema,
        tags=set(),
    )