Skip to content

Dynamic tool registration

Dynamic tool registration lets the MCP server discover DataRobot deployments and expose them as MCP tools automatically. When a tool is invoked, the server proxies the request to the registered deployment.

This capability is available in MCP servers built with the DataRobot MCP template and the DataRobot Agentic Starter template. For MCP server setup and agent integration, see Integrate tools using an MCP server.

クイックスタート

  1. Deploy your model or service to DataRobot.
  2. Tag the deployment with tool as both the tag name and the tag value.
  3. Start the server with dynamic tool registration enabled, if needed.

To enable auto-discovery on startup (optional):

MCP_SERVER_REGISTER_DYNAMIC_TOOLS_ON_STARTUP=true 

For most deployment types, no additional configuration is needed.

Supported deployment types

デプロイのタイプ Configuration needed
DataRobot native predictive models None. Tag the deployment as tool.
DRUM structured predictions None. Optionally define inputSchema in model-metadata.yaml.
DRUM agentic workflows None. Optionally define inputSchema in model-metadata.yaml.
DRUM unstructured models Define inputSchema in model-metadata.yaml.
Custom servers, such as FastAPI services Expose an /info/ endpoint with tool metadata.

Registering other MCP servers as tools through dynamic tool registration is not supported.

Registration requirements

All deployments must:

  • Be active.
  • Be tagged with tool as both the name and value.

Additional requirements depend on the deployment type:

  • DataRobot native models: No extra requirements.
  • DRUM unstructured models: Define inputSchema in model-metadata.yaml.
  • Custom servers: Expose /info/ and return endpoint, method, and input_schema.

Runtime API

Use these endpoints on the MCP server to manage registrations at runtime:

  • GET /registeredDeployments: List registered tools.
  • PUT /registeredDeployments/{deployment_id}: Register a tool.
  • DELETE /registeredDeployments/{deployment_id}: Remove a tool.

For example, the GET /registeredDeployments endpoint can be implemented as follows:

List registered deployments (excerpt)
@mcp.custom_route(prefix_mount_path("/registeredDeployments"), methods=["GET"])
async def list_deployments(_: Request) -> JSONResponse:
    """List all deployments."""
    try:
        deployments = await get_registered_tool_deployments()
        formatted_deployments = [
            {"deploymentId": k, "toolName": v} for k, v in deployments.items()
        ]
        return JSONResponse(
            status_code=HTTPStatus.OK,
            content={
                "deployments": formatted_deployments,
                "count": len(deployments),
            },
        )
    except Exception as e:
        return JSONResponse(
            status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
            content={"error": f"Failed to retrieve deployments: {str(e)}"},
        ) 

DRUM deployments

DataRobot DRUM deployments usually work with little or no additional configuration.

Zero configuration (for most cases)

For these deployment types, tag the deployment as tool and the server can register it automatically:

  • Structured predictions, including binary, regression, and multiclass models.
  • Agentic workflows.
  • DataRobot native predictive models.

Unstructured models

For an unstructured target type, add inputSchema to model-metadata.yaml:

model-metadata.yaml
name: "Fetch dataset"
description: "Fetches a dataset from DataRobot Data Registry"
type: inference
targetType: unstructured
inputSchema:
  type: object
  properties:
    json:
      type: object
      properties:
        dataset_id:
          type: string
          description: Dataset ID from Data Registry
        limit:
          type: integer
          default: 100
      required:
        - dataset_id 

Unstructured model schemas

  • For unstructured models, define request parameters under the json property.
  • Exposing input schemas from model-metadata.yaml requires datarobot-drum version 1.17.2 or later.

Optional custom schema

You can override fallback schemas to give the LLM better guidance or tighter control over the request shape:

model-metadata.yaml (custom inputSchema)
inputSchema:
  type: object
  properties:
    data:
      type: string
      description: "CSV with columns: transaction_amount, user_age, merchant_category"
  required:
    - data 

Custom server deployments

For FastAPI, Flask, and similar services, expose an /info/ endpoint that returns tool metadata.

Required /info/ response

{
  "endpoint": "directAccess/weather/{city}",
  "method": "GET",
  "input_schema": {
    "type": "object",
    "properties": {
      "path_params": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string",
            "description": "City name"
          }
        },
        "required": ["city"]
      }
    }
  }
} 

FastAPI example

FastAPI custom server (excerpt)
from fastapi import FastAPI
from pydantic import BaseModel, Field

app = FastAPI()

class WeatherRequest(BaseModel):
    class PathParams(BaseModel):
        city: str = Field(description="City name")

    class QueryParams(BaseModel):
        units: str = Field(default="metric", description="metric or imperial")

    path_params: PathParams
    query_params: QueryParams | None = None

@app.get("/info/")
async def metadata():
    return {
        # Custom model deployments expose custom server routes behind directAccess/.
        "endpoint": "directAccess/weather/{city}",
        "method": "GET",
        "input_schema": WeatherRequest.model_json_schema(),
    }

@app.get("/weather/{city}")
async def get_weather(city: str, units: str = "metric"):
    return {"city": city, "temp": 22, "units": units} 

Request mapping

Given this tool call:

{
  "path_params": {"city": "paris"},
  "query_params": {"units": "imperial"}
} 

the MCP server generates a request like:

GET <base_url>/directAccess/weather/paris?units=imperial 

各パラメーターについて説明します。

  • base_url is derived from the DataRobot deployment URL.
  • directAccess/ is the prefix used for custom server endpoints in custom model deployments.

Input schema reference

Parameter groups

Parameters map to HTTP requests as follows:

グループ 目的
path_params Substitutes values into the URL path. {city}"paris"
query_params Adds query-string parameters. ?units=imperial
data Sends a raw request body, such as CSV. Not used in the weather example.
json Sends a JSON request body. Not used in the weather example.

ルール

  • path_params and query_params must be flat objects.
  • data and json can contain nested structures.
  • Every {param} in the endpoint must be present in path_params.
  • Empty schemas are allowed only when MCP_SERVER_TOOL_REGISTRATION_ALLOW_EMPTY_SCHEMA=true.

What the server does

Internally, the MCP server transforms tool calls into HTTP requests. For the weather example, the request looks like this:

async with session.request(
    method="GET",
    url="<base_url>/directAccess/weather/paris",
    params={"units": "imperial"},
) as response:
    return await response.json() 

トラブルシューティング

Tool does not register

Use these commands to inspect the deployment and, for DRUM or custom servers, test the /info/ endpoint:

# Check that the deployment is active and tagged correctly.
curl -H "Authorization: Bearer $DATAROBOT_API_TOKEN" \
  "$DATAROBOT_ENDPOINT/api/v2/deployments/{deployment-id}/" | jq .

# Check the /info/ endpoint for DRUM and custom server deployments.
curl -H "Authorization: Bearer $DATAROBOT_API_TOKEN" \
  "$DATAROBOT_ENDPOINT/api/v2/deployments/{deployment-id}/directAccess/info/" | jq . 

Common errors

エラー Fix
Missing input_schema Add input_schema to the /info/ response for custom servers, or add inputSchema to model-metadata.yaml for DRUM unstructured models.
Unsupported top-level property Use only path_params, query_params, data, and json.
Nested structure in path_params Flatten the structure or move it to json.
Missing path parameter Define every path variable from the endpoint in path_params.

その他のリソース