|
/ Documentation /Developers Documentation/ Add Entries to the AI Catalog surerank_pro_ai_catalog_entries

Add Entries to the AI Catalog surerank_pro_ai_catalog_entries

Hook: surerank_pro_ai_catalog_entries

Description: The surerank_pro_ai_catalog_entries filter changes the list of entries in the AI catalog that SureRank Pro publishes at /.well-known/ai-catalog.json. By default the catalog lists the MCP server, the WordPress REST API, the Agent Skills index, and llms.txt, whichever of them are on. The filter can add a resource of your own, or remove an entry that should not be listed.

Source: inc/modules/ai-readability/ai-catalog.php (SureRank Pro)

Usage: Use this filter to add or remove entries in the AI catalog. The filter receives one value, $entries, which is a list of entries, and it must return a list. Each entry is an array with these keys:

  • identifier: a unique name for the entry. The built-in entries use the form urn:air:<domain>:<group>:<name>.
  • displayName: the name an agent shows for the entry.
  • type: the media type of the document the entry points to, for example application/json.
  • url: the address of the document.
  • representativeQueries: a list of short questions that the entry can answer.

Note:

This filter is available in SureRank Pro, version 1.12.0 or later, and it needs the Publish an AI Catalog switch to be on. See How to Publish Agent Discovery Files in SureRank.

Example: Add an Entry to the Catalog

If you’re looking to list your own resource in the AI catalog, add the code below. Replace the name, the address, and the question with your own.

// Add an entry to the AI catalog.
add_filter( 'surerank_pro_ai_catalog_entries', 'my_ai_catalog_entry' );

function my_ai_catalog_entry( $entries ) {
    // The domain of the site, used to build a unique name for the entry.
    $host = wp_parse_url( home_url(), PHP_URL_HOST );

    $entries[] = array(
        // A unique name. Built-in entries use urn:air:<domain>:<group>:<name>.
        'identifier'            => 'urn:air:' . $host . ':api:my-plugin',

        // The name an agent shows for the entry.
        'displayName'           => 'My Plugin REST API',

        // The media type of the document the entry points to.
        'type'                  => 'application/linkset+json',

        // The address of that document.
        'url'                   => home_url( '/my-plugin-catalog.json' ),

        // Short questions that this entry can answer.
        'representativeQueries' => array( 'list the products in the shop' ),
    );

    // Always return the list.
    return $entries;
}

Example: Remove an Entry From the Catalog

If you’re looking to leave the llms.txt entry out of the catalog, add the code below. To remove a different entry, replace :llms-txt with the end of that entry’s identifier, for example :skills:index.

// Remove the llms.txt entry from the AI catalog.
add_filter( 'surerank_pro_ai_catalog_entries', 'my_remove_llms_entry' );

function my_remove_llms_entry( $entries ) {
    // Keep every entry except the one whose identifier contains ":llms-txt".
    return array_filter(
        $entries,
        function ( $entry ) {
            return false === strpos( $entry['identifier'], ':llms-txt' );
        }
    );
}

You can add the example code to your child theme’s functions.php file or use a plugin like Code Snippets to safely insert custom code. Using a code snippet plugin is recommended for easier management and to ensure the code remains active even if you switch themes.

Expected Outcome

After you add the first example, open https://example.com/.well-known/ai-catalog.json in a browser. Replace example.com with your domain. The catalog now lists the new entry at the end of the entries list.

After you add the second example instead, the llms.txt entry is no longer in the list.

Notes

  • The catalog is served only while at least one of the API catalog, the MCP server card, the Agent Skills index, or llms.txt is on. An entry added by the filter does not make the catalog appear on its own.
  • The filter must return a list. Return $entries at the end of the function.
  • SureRank renumbers the list after the filter runs, so removing an entry always gives a valid list.
  • SureRank does not change or remove the entries that the filter returns, so check the catalog in a browser after each change.
  • AI Ready Checks tests the catalog. Every entry needs an identifier, and a url or inline data. An entry that is missing them makes the AI Catalog row show a Warning that reads “Something else is answering at /.well-known/ai-catalog.json.”

Related Docs

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top