Filter uncanny-automator

automator_mcp_client_inference_url

Filters the API client inference URL before it is used for external service requests.

add_filter( 'automator_mcp_client_inference_url', $callback, 10, 1 );

Description

Filters the inference URL used by the Uncanny Automator API client. Developers can use this to dynamically change the endpoint for inference requests, perhaps for testing or custom deployments. The hook fires just before the URL is returned for use.


Usage

add_filter( 'automator_mcp_client_inference_url', 'your_function_name', 10, 1 );

Parameters

$url (mixed)
This parameter holds the URL for the MCP client's inference endpoint.

Return Value

The filtered value.


Examples

add_filter( 'automator_mcp_client_inference_url', 'my_custom_automator_inference_url', 10, 1 );

/**
 * Filters the Automator MCP client inference URL to use a staging environment endpoint.
 *
 * This function allows developers to override the default inference URL,
 * for example, to point to a staging or development server for testing.
 *
 * @param string $url The current inference URL.
 * @return string The modified inference URL.
 */
function my_custom_automator_inference_url( $url ) {
	// Check if we are in a staging environment (e.g., defined by a constant).
	if ( defined( 'MY_STAGING_ENVIRONMENT' ) && MY_STAGING_ENVIRONMENT ) {
		return 'https://staging.automator.example.com/inference';
	}

	// Otherwise, return the original URL.
	return $url;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/api/application/mcp/class-mcp-client.php:388

public static function get_inference_url(): string {
		$url = defined( 'AUTOMATOR_MCP_CLIENT_INFERENCE_URL' )
			&& AUTOMATOR_MCP_CLIENT_INFERENCE_URL
				? AUTOMATOR_MCP_CLIENT_INFERENCE_URL
				: self::INFERENCE_URL;

		return apply_filters( 'automator_mcp_client_inference_url', $url );
	}

Scroll to Top