Skip to content

datarobot_genai.drmcp.core.dynamic_tools.register

register

register_external_tool async

register_external_tool(config: ExternalToolRegistrationConfig, auth_headers: Callable[[], dict[str, str]] | None = None, **kwargs: Any) -> Tool

Create and register a generic HTTP tool in the MCP server.

Parameters:

Name Type Description Default
config ExternalToolRegistrationConfig

ExternalToolRegistrationConfig object containing all tool parameters.

required
auth_headers Callable[[], dict[str, str]] | None

Returns auth headers for the current call. They replace the config's.

None
**kwargs Any

Additional keyword arguments to pass to tools registration.

{}
Returns
The registered Tool instance with full MCP integration.
Source code in datarobot_genai/drmcp/core/dynamic_tools/register.py
async def register_external_tool(
    config: ExternalToolRegistrationConfig,
    auth_headers: Callable[[], dict[str, str]] | None = None,
    **kwargs: Any,
) -> Tool:
    """Create and register a generic HTTP tool in the MCP server.

    Args:
        config: ExternalToolRegistrationConfig object containing all tool parameters.
        auth_headers: Returns auth headers for the current call. They replace the config's.
        **kwargs: Additional keyword arguments to pass to tools registration.

    Returns
    -------
        The registered Tool instance with full MCP integration.
    """
    external_tool_callable = _external_tool_callable_factory(
        config,
        allow_empty=get_config().mcp_server_tool_registration_allow_empty_schema,
        auth_headers=auth_headers,
    )

    registered_tool = await register_tools(
        fn=external_tool_callable,
        name=config.name,
        title=config.title,
        description=config.description,
        tags=config.tags,
        **kwargs,
    )

    return registered_tool