# metasync/2.6.14/wp-mcp-server/tools/class-mcp-tool-breadcrumbs.php

Search Atlas SEO – OTTO AI SEO Automation for WordPress, version 2.6.14. 86 lines.

- Page: https://pluginprobe.com/plugins/metasync/2.6.14/code/wp-mcp-server/tools/class-mcp-tool-breadcrumbs.php
- Raw: https://pluginprobe.com/plugins/metasync/2.6.14/raw/wp-mcp-server/tools/class-mcp-tool-breadcrumbs.php
- Modified: 2026-04-23T21:08:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/metasync/2.6.14/code/wp-mcp-server/tools/class-mcp-tool-breadcrumbs.php#L10-L20`.

```php
<?php
/**
 * MCP Tool — Get Breadcrumb Path
 *
 * Returns the resolved breadcrumb trail for a given post or page.
 *
 * @package    MetaSync
 * @subpackage MCP_Server/Tools
 * @since      2.9.0
 */

if (!defined('ABSPATH')) {
    exit;
}

class MCP_Tool_Get_Breadcrumb_Path extends MCP_Tool_Base {

    /**
     * @inheritDoc
     */
    public function get_name() {
        return 'wordpress_get_breadcrumb_path';
    }

    /**
     * @inheritDoc
     */
    public function get_description() {
        return 'Get the resolved breadcrumb trail for a post or page';
    }

    /**
     * @inheritDoc
     */
    public function get_input_schema() {
        return array(
            'type'       => 'object',
            'properties' => array(
                'post_id' => array(
                    'type'        => 'integer',
                    'description' => 'The post ID to resolve the breadcrumb trail for',
                ),
            ),
            'required' => array('post_id'),
        );
    }

    /**
     * @inheritDoc
     */
    public function execute($params) {
        $this->validate_params($params);
        $this->require_capability('edit_posts');

        $post_id = intval($params['post_id']);
        $this->check_post_permission($post_id);
        $this->verify_post_exists($post_id);

        $breadcrumbs = new Metasync_Breadcrumbs();
        $trail       = $breadcrumbs->resolve_breadcrumb_trail($post_id);

        if (!function_exists('is_plugin_active')) {
            require_once ABSPATH . 'wp-admin/includes/plugin.php';
        }

        $payload = array(
            'post_id'      => $post_id,
            'trail'        => $trail,
            'trail_count'  => count($trail),
            'custom_label' => get_post_meta($post_id, '_metasync_breadcrumb_title', true),
        );

        if (is_plugin_active('wordpress-seo/wp-seo.php') ||
            is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) {
            $payload['yoast_label'] = get_post_meta($post_id, '_yoast_wpseo_bctitle', true);
        }

        if (is_plugin_active('seo-by-rank-math/rank-math.php') ||
            is_plugin_active('seo-by-rankmath/rank-math.php')) {
            $payload['rankmath_label'] = get_post_meta($post_id, 'rank_math_breadcrumb_title', true);
        }

        return $this->success($payload);
    }
}

```
