Title: WP_AI_Client_Prompt_Builder::using_abilities
Published: May 20, 2026

---

# WP_AI_Client_Prompt_Builder::using_abilities( WP_Ability|string $abilities ): self

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#wp--skip-link--target)

Registers WordPress abilities as function declarations for the AI model.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#description)󠁿

Converts each [WP_Ability](https://developer.wordpress.org/reference/classes/wp_ability/)
to a FunctionDeclaration using the wpab__ prefix naming convention and passes them
to the underlying prompt builder.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#parameters)󠁿

 `$abilities`[WP_Ability](https://developer.wordpress.org/reference/classes/wp_ability/)
|stringrequired

The abilities to register, either as [WP_Ability](https://developer.wordpress.org/reference/classes/wp_ability/)
objects or ability name strings.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#return)󠁿

 self The current instance for method chaining.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#source)󠁿

    ```php
    public function using_abilities( ...$abilities ): self {
    	$declarations = array();

    	foreach ( $abilities as $ability ) {
    		if ( is_string( $ability ) ) {
    			$ability_name = $ability;
    			$ability      = wp_get_ability( $ability );
    			if ( ! $ability ) {
    				_doing_it_wrong(
    					__METHOD__,
    					sprintf(
    						/* translators: %s: string value of the ability name. */
    						__( 'The ability %s was not found.' ),
    						'<code>' . esc_html( $ability_name ) . '</code>'
    					),
    					'7.0.0'
    				);
    				continue;
    			}
    		}

    		// This is only here as a sanity check, the method signature should ensure this already.
    		if ( ! $ability instanceof WP_Ability ) {
    			continue;
    		}

    		$function_name = WP_AI_Client_Ability_Function_Resolver::ability_name_to_function_name( $ability->get_name() );
    		$input_schema  = $ability->get_input_schema();

    		$declarations[] = new FunctionDeclaration(
    			$function_name,
    			$ability->get_description(),
    			! empty( $input_schema ) ? $input_schema : null
    		);
    	}

    	if ( ! empty( $declarations ) ) {
    		return $this->using_function_declarations( ...$declarations );
    	}

    	return $this;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php#L237)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php#L237-L278)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#related)󠁿

| Uses | Description | 
| [FunctionDeclaration::__construct()](https://developer.wordpress.org/reference/classes/wordpress-aiclient-tools-dto-functiondeclaration/__construct/)`wp-includes/php-ai-client/src/Tools/DTO/FunctionDeclaration.php` |

Constructor.

  | 
| [WP_AI_Client_Ability_Function_Resolver::ability_name_to_function_name()](https://developer.wordpress.org/reference/classes/wp_ai_client_ability_function_resolver/ability_name_to_function_name/)`wp-includes/ai-client/class-wp-ai-client-ability-function-resolver.php` |

Converts an ability name to a function name.

  | 
| [wp_get_ability()](https://developer.wordpress.org/reference/functions/wp_get_ability/)`wp-includes/abilities-api.php` |

Retrieves a registered ability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  | 
| [_doing_it_wrong()](https://developer.wordpress.org/reference/functions/_doing_it_wrong/)`wp-includes/functions.php` |

Marks something as being incorrectly called.

  |

[Show 3 more](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_ai_client_prompt_builder%2Fusing_abilities%2F)
before being able to contribute a note or feedback.