Skip to content

Abilities for AI agents and automations

The WordPress Abilities API is a directory of what a website can do: each ability has a name, a description, a schema for its input and its result, and a permission check. AI agents and automations read this directory and call the abilities without knowing the website beforehand.

From version 5.72.0, WP-ImmoMakler registers twelve abilities in the immomakler category. Nine of them only read; the three actions start the import, flush the cache and install the starter templates. immomakler/interpret-search queries your website’s AI provider and counts towards the AI search limits (see below). They need no setting: as soon as the plugin is active, they are registered.

Properties, contact persons and enquiries PLUS

Section titled “Properties, contact persons and enquiries ”
Ability Result Required permission REST API and MCP
immomakler/search-properties One page of the property list, filtered like the search form edit_immomakler_properties yes
immomakler/get-property One property with all its details edit_immomakler_properties yes
immomakler/list-terms The property categories with their terms edit_immomakler_properties yes
immomakler/list-contacts The published contact persons edit_immomakler_persons yes
immomakler/list-enquiries The stored enquiries manage_immomakler_enquiries no
immomakler/interpret-search The search filters for a free-text search request edit_immomakler_properties yes

Administrators have these permissions and, when “Activate rights for editors” is switched on, so do editors. An ability always runs with the rights of the logged-in user; without the permission, WordPress rejects the call.

From WordPress 7.2, WordPress ships its own abilities for content. core/content-query also finds your published properties (immomakler_object) and contact persons (immomakler_person), in all editions. The ability returns the title, excerpt, link and date for properties and the name and link for contact persons, but no property data such as price or area and no contact details; for those, use immomakler/search-properties and immomakler/get-property.

WordPress answers the query for every logged-in user, subscribers included. It therefore applies only to content that is public anyway: without an active licence, properties and contact persons are excluded, properties beyond your edition’s limit always are, and so are contact persons whose own pages have been switched off through the immomakler_person_publicly_queryable filter. core/content-query never finds enquiries.

These three abilities are available in all editions. Only administrators have their permissions.

Ability Result Required permission REST API and MCP
immomakler/get-import-status The state of the import with the import files manage_immomakler_importer yes
immomakler/get-license-status Edition, licence status and property limit manage_immomakler_options yes
immomakler/get-system-info The system information manage_immomakler_options yes

These three abilities change something on your website. They are available in all editions, and only administrators have their permissions. Through the REST API you do not call them with GET, but with the method the table names.

Ability What it does Required permission REST method
immomakler/run-import Starts the import of the files in the import directory manage_immomakler_importer POST
immomakler/flush-cache Flushes the WP-ImmoMakler cache manage_immomakler_options POST
immomakler/install-starter-templates Creates or updates the starter templates in the page builder manage_immomakler_options DELETE

WordPress derives the method from the kind of ability: DELETE stands for an ability that can overwrite something and changes nothing further on a second call. The starter templates overwrite changes you have made to them.

immomakler/search-properties takes the same filters as the /search route of the headless API and returns the same result. The input schema is built from your website’s search: it names exactly the categories and value ranges your property list can filter by.

Input Meaning
type, marketing, location, features and more Slugs of the terms of a category. Several separated by a comma: any one of them must match. Separated by +: all of them must match
price_min, price_max, area_min and more Lower and upper limit of a value range
id Object number or its beginning
center, radius Place, postcode or address and radius in kilometres, when the radius search is active
status open (default, like the property list), reference or all
order Sort order, using the keys of your list’s sort options
fields summary (default) for the details of a list, full for all details
facets true adds the number of hits per term
page, per_page Page and number per page, 100 at most
locale Language of the labels, e.g. en

immomakler/list-terms returns the slugs and the filter names: each category gives the name of its filter under param and its terms under terms.

The result contains the properties under items, the total number under total, and under applied the filters as they were understood. A filter the schema does not know is rejected with an error.

immomakler/get-property expects the object number (object_number) or the post ID (post_id) of a published property and returns the document the headless API outputs under /properties/{id}. The object number is part of every search result; the post ID is named by the enquiries. With the post ID you get exactly that property, so on a multilingual website in its own language.

immomakler/list-enquiries returns the stored enquiries, newest first, with sender, contact details, message and the properties asked about. spam_suspected indicates whether the enquiry was flagged as suspected spam. With property_id you restrict the list to one property, with since to enquiries from a given point in time in ISO 8601 format. A point in time without a time zone is read in your website’s time zone.

Translating a search request into search filters

Section titled “Translating a search request into search filters”

immomakler/interpret-search passes a sentence such as “3-room flat with balcony up to 300,000 EUR in Hamburg” to the AI search and returns the filters for immomakler/search-properties under params. Under summary you can see which details were used and which are not covered by any filter.

The ability requires AI search to be enabled. Every new request goes to your website’s AI provider and counts towards the AI search limits. It is therefore not treated as read-only, and the REST API runs it only via POST.

immomakler/get-import-status returns what you see in the backend of your website (wp-admin) under WP-ImmoMakler → Property Importer and with wp immomakler import status:

Result Meaning
directory, directory_exists The import directory on the server and whether it exists
automatic_import Whether the automatic import is switched on
license_active Whether the licence is active; without it WP-ImmoMakler imports nothing
running, reset_running, lock_seconds_left Whether an import is currently running or all property data is being reset, and how long the import is still locked
last_file_finished_gmt When a file was last imported completely
files_left, files_given_up, files_total Files still to be imported, files given up after an error, and all files
files The latest import files with name, status, progress (properties_imported of properties_total) and error message

The status of a file is new (not yet imported), changed (imported and replaced afterwards), given up (given up after an error) or the state of the importer, e.g. imported or processing. With the input files you set how many files are listed (default 50, at most 500); 0 returns only the figures.

immomakler/get-license-status returns the edition (edition), the status last reported by the licence server (status, active, expires) and the number of published properties in relation to the edition’s limit (properties_count, properties_limit, properties_remaining). For an edition without a limit, properties_limit and properties_remaining are empty (null).

The ability returns the stored state and does not query the licence server. The licence key is not included.

immomakler/get-system-info returns as data what you see in the backend of your website (wp-admin) under WP-ImmoMakler → System info: the versions of WP-ImmoMakler, WordPress and PHP, missing PHP extensions, the PHP memory limit and the measured maximum execution time, the theme, the active page builders, a multilingual plugin, the import directory with its write permissions, the template directories, the free disk space, the number of attachments and the number of published properties per CRM software.

immomakler/run-import starts an import of the files in the import directory, as the automatic import does, even when it is switched off. The import runs in the background via WP-Cron; the ability responds immediately. If ALTERNATE_WP_CRON is set on your website, it begins with the next page view. How far it has got is returned by immomakler/get-import-status.

Result Meaning
started Whether an import was started
reason Why none was started: already_running (an import is already running), nothing_to_import (no file pending) or cron_not_running (an import started earlier has been waiting for over an hour; WP-Cron is probably not running on your website, as the website state also reports)
files_left The files still to be imported
automatic_import Whether the automatic import is switched on. Without it, a call imports as much as fits into your server’s maximum execution time; a larger file needs another call
wp_cron_disabled Whether WP-Cron on your website is triggered only by the server (DISABLE_WP_CRON); the import then begins with the server’s next call

Without an active licence, without an import directory and while all property data is being reset, the ability rejects the call with an error. It never takes over a running import; only wp immomakler import run --force can do that.

immomakler/flush-cache deletes everything in the WP-ImmoMakler cache, like wp immomakler cache flush. This includes map images, coordinates and AI responses. WP-ImmoMakler recreates each file when it is needed: the first call of a PDF expose or a map takes longer afterwards, and the next import queries geo services and AI providers again. The result names the freed storage under freed_bytes and the part that could not be deleted under left_bytes.

immomakler/install-starter-templates creates the starter templates in your website’s page builder and assigns them to the properties, reference properties, projects, the property list and the references list, like wp immomakler starter-templates install.

Input Meaning
builder The page builder, e.g. elementor, divi5 or gutenberg. If omitted, the page builder from the setup wizard, otherwise the first one found
target single, reference, project, archive, reference-list or all (default)
dry_run true changes nothing and only returns which templates would be created (would_create) and which would be overwritten (would_update)

The result lists under templates each template and each part of it, such as the list card of a property list (role: card), with its post and whether it was created (created) or updated (updated), and under notes hints from the page builder. Besides the templates themselves, the installation also writes their assignment, depending on the page builder into the settings of the theme or of the theme builder.

$ability = wp_get_ability( 'immomakler/search-properties' );
$result = $ability->execute(
[
'type' => 'wohnung',
'price_max' => 300000,
'per_page' => 5,
]
);
if ( is_wp_error( $result ) ) {
return;
}
foreach ( $result['items'] as $property ) {
printf( "%s: %s\n", $property['object_number'], $property['title'] );
}

execute() checks the input against the schema and the permission of the logged-in user, and returns a WP_Error on failure.

WordPress provides the abilities under /wp-json/wp-abilities/v1/. The request must be authenticated as a user with the required permission, for example with an application password.

Terminal window
# The WP-ImmoMakler abilities with their schemas
curl --user "user:application-password" \
"https://example.com/wp-json/wp-abilities/v1/abilities?category=immomakler"
# Flats up to 300,000 EUR
curl --user "user:application-password" --get \
--data-urlencode "input[type]=wohnung" \
--data-urlencode "input[price_max]=300000" \
"https://example.com/wp-json/wp-abilities/v1/abilities/immomakler/search-properties/run"
# Start the import
curl --user "user:application-password" -X POST \
"https://example.com/wp-json/wp-abilities/v1/abilities/immomakler/run-import/run"

The Model Context Protocol (MCP) is the way AI agents such as Claude, ChatGPT or Cursor use the abilities of a website. The bridge for this is the WordPress plugin MCP Adapter. WP-ImmoMakler releases its abilities for it, except for enquiries. An agent can only call what the user it is logged in as is allowed to do.

  1. Install MCP Adapter

    Install and activate the MCP Adapter plugin in the backend of your website (wp-admin) under Plugins → Add New.

  2. Create an application password

    Under Users → Profile, create an application password for a user with the required permissions. The agent works with the rights of this user.

  3. Connect the agent

    In the AI agent, enter your website’s MCP server: https://example.com/wp-json/mcp/mcp-adapter-default-server, with the username and the application password. How to do this is described in the agent’s documentation; for agents that only support local MCP servers, there is the proxy @automattic/mcp-wordpress-remote.

  4. Ask questions

    Ask the agent, for example, “Which flats up to 300,000 EUR do we have in Hamburg?” or “Is the import running right now?”. The agent picks the suitable ability and calls it.

With the filter immomakler_ability_public you decide whether an ability can be reached through the REST API and through MCP. It receives whether the ability is public, and its name. Even a released ability still checks the permission of the logged-in user. Add the filter in a plugin or in your theme’s functions.php: WordPress evaluates it once, when it first reads in the abilities.

add_filter(
'immomakler_ability_public',
function ( bool $public, string $name ): bool {
return 'immomakler/list-enquiries' === $name ? true : $public;
},
10,
2
);

Consider two consequences before releasing the enquiries:

  • The data goes to the AI provider. What an ability delivers to an AI agent is processed by the language model behind the agent. Names, email addresses, phone numbers and messages of your prospects thus go to its provider. Clarify whether your privacy policy and your contracts with the provider cover this.
  • Enquiries contain text from third parties. The message of an enquiry is written by an arbitrary visitor to your website. It can contain instructions to an AI agent that the agent follows when it reads them (prompt injection). Release enquiries only to an agent that may not change or send anything on your website or elsewhere.

Likewise, you take abilities out, for example the actions, when agents should only read:

add_filter(
'immomakler_ability_public',
function ( bool $public, string $name ): bool {
$actions = [ 'immomakler/run-import', 'immomakler/flush-cache', 'immomakler/install-starter-templates' ];
return in_array( $name, $actions, true ) ? false : $public;
},
10,
2
);

To remove an ability your website should not offer at all, use wp_unregister_ability().