PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / trunk
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO vtrunk
2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.10.0 1.11.0 All 47 releases
thinkrank / includes / abilities / analysis / class-get-connection-status.php

class-get-connection-status.php in ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO trunk, at includes/abilities/analysis/class-get-connection-status.php

117 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Get connection status ability.
4 *
5 * @package ThinkRank\Abilities\Analysis
6 */
7
8 declare(strict_types=1);
9
10 namespace ThinkRank\Abilities\Analysis;
11
12 use ThinkRank\Abilities\Ability_Base;
13 use ThinkRank\Diagnostics\Connection_Status;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // Exit if accessed directly.
17 }
18
19 /**
20 * Reports ThinkRank's own integration health so an AI/MCP client can tell a
21 * certificate problem from an authentication problem from a permission problem
22 * from an ability-registration problem — without inspecting plugin source or DB
23 * tables by hand (see #188).
24 *
25 * Read-only and side-effect free. Never returns secret material (API keys,
26 * OAuth tokens, connection tokens).
27 */
28 class Get_Connection_Status extends Ability_Base {
29 /**
30 * Constructor.
31 */
32 public function __construct() {
33 $this->id = 'thinkrank/get-connection-status';
34 $this->label = __( 'Get Connection Status', 'thinkrank' );
35 $this->description = __( 'Report ThinkRank integration health: plugin/Pro versions and active state, Abilities API availability and the count + names of registered ThinkRank abilities, MCP server toggle and endpoints, the current user and their ThinkRank capabilities, home/siteurl/REST URL scheme agreement and HTTPS state, custom database-table status, and scoring availability. Never returns API keys, OAuth tokens, or connection tokens.', 'thinkrank' );
36 }
37
38 /**
39 * {@inheritDoc}
40 *
41 * @return array<string, bool|float|string>
42 */
43 public function get_annotations() {
44 return [
45 'readonly' => true,
46 'destructive' => false,
47 'idempotent' => true,
48 'priority' => 1.0,
49 'openWorldHint' => false,
50 ];
51 }
52
53 /**
54 * {@inheritDoc}
55 *
56 * @return array<string, mixed>
57 */
58 public function get_input_schema() {
59 return [
60 'type' => 'object',
61 'additionalProperties' => false,
62 'properties' => self::empty_properties(),
63 ];
64 }
65
66 /**
67 * {@inheritDoc}
68 *
69 * @return array<string, mixed>
70 */
71 public function get_output_schema() {
72 return [
73 'type' => 'object',
74 'properties' => [
75 'plugin' => [
76 'type' => 'object',
77 'additionalProperties' => true,
78 ],
79 'abilities' => [
80 'type' => 'object',
81 'additionalProperties' => true,
82 ],
83 'mcp_server' => [
84 'type' => 'object',
85 'additionalProperties' => true,
86 ],
87 'user' => [
88 'type' => 'object',
89 'additionalProperties' => true,
90 ],
91 'urls' => [
92 'type' => 'object',
93 'additionalProperties' => true,
94 ],
95 'database' => [
96 'type' => 'object',
97 'additionalProperties' => true,
98 ],
99 'scoring' => [
100 'type' => 'object',
101 'additionalProperties' => true,
102 ],
103 ],
104 ];
105 }
106
107 /**
108 * Execute ability.
109 *
110 * @param array<string, mixed> $input Ability input payload.
111 * @return array<string, mixed>
112 */
113 public function execute( $input ) {
114 return Connection_Status::report();
115 }
116 }
117