'object', 'required' => array( 'post_id' ), 'properties' => array( 'post_id' => array( 'type' => 'integer', 'description' => __( 'The Post/Page/Custom Post Type ID to read Kit settings for.', 'convertkit' ), 'minimum' => 1, ), ), ); } /** * Executes the ability. * * @since 3.4.0 * * @param array $input Ability input. * @return array|WP_Error */ public function execute_callback( $input ) { $post_id = isset( $input['post_id'] ) ? absint( $input['post_id'] ) : 0; // Bail if the Post does not exist. if ( ! get_post( $post_id ) ) { return new WP_Error( 'convertkit_mcp_post_not_found', sprintf( /* translators: %d: Post ID. */ __( 'Post %d does not exist.', 'convertkit' ), $post_id ) ); } // Load the Post's settings. $post_settings = new ConvertKit_Post( $post_id ); $settings = $post_settings->get(); // Cast values to string so they match the output schema (Post storage // keeps them as strings, but defense-in-depth for numeric coercion). return array( 'post_id' => $post_id, 'form' => (string) $settings['form'], 'landing_page' => (string) $settings['landing_page'], 'tag' => (string) $settings['tag'], 'restrict_content' => (string) $settings['restrict_content'], ); } }