id = 'thinkrank/get-llms-txt-settings'; $this->label = __( 'Get ThinkRank llms.txt Settings', 'thinkrank' ); $this->description = __( 'Retrieve ThinkRank llms.txt settings, which describe the site to AI language models via the llms.txt file. Use update-llms-txt-settings to change them, and generate-llms-txt to preview the result.', 'thinkrank' ); } /** * {@inheritDoc} * * @return array */ public function get_annotations() { return [ 'readonly' => true, 'destructive' => false, 'idempotent' => true, 'priority' => 1.0, 'openWorldHint' => false, ]; } /** * Build the JSON schema properties for llms.txt settings. * * @return array */ private static function schema_properties() { $props = []; foreach ( self::BOOL_KEYS as $key ) { $props[ $key ] = [ 'type' => 'boolean' ]; } foreach ( self::STRING_KEYS as $key ) { $props[ $key ] = [ 'type' => 'string' ]; } $props['delivery_mode']['enum'] = [ 'auto', 'static', 'dynamic' ]; $props['delivery_mode']['description'] = __( 'How /llms.txt is served: "static" writes a physical file the web server answers, "dynamic" keeps the document in WordPress and serves it from PHP as UTF-8, "auto" prefers static on Apache/LiteSpeed but falls back to dynamic when the published file turns out to be served without a character set.', 'thinkrank' ); return $props; } /** * {@inheritDoc} * * @return array */ public function get_input_schema() { return [ 'type' => 'object', 'additionalProperties' => false, 'properties' => self::empty_properties(), ]; } /** * {@inheritDoc} * * @return array */ public function get_output_schema() { return [ 'type' => 'object', 'properties' => [ 'settings' => [ 'type' => 'object', 'properties' => self::schema_properties(), ], ], ]; } /** * Execute ability. * * @param array $input Ability input payload. * @return array */ public function execute( $input ) { $mgr = new LLMs_Txt_Manager(); $s = $mgr->get_settings( 'site', null ); $out = []; foreach ( self::BOOL_KEYS as $key ) { $out[ $key ] = (bool) ( $s[ $key ] ?? false ); } foreach ( self::STRING_KEYS as $key ) { $out[ $key ] = (string) ( $s[ $key ] ?? '' ); } return [ 'settings' => $out ]; } }