array( 'object', 'null' ), ); } /** * Returns the resource's output JSON Schema. * * Resource content is returned as a single string, wrapped as text content * by the MCP Adapter. * * @since 3.4.2 * * @return array */ public function get_output_schema() { return array( 'type' => 'string', ); } /** * Permission callback. * * Sub classes can override this to implement their own permission callback. * * @since 3.4.2 * * @param array $input Resource input (unused). * @return bool|WP_Error */ public function permission_callback( $input ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found if ( ! current_user_can( 'manage_options' ) ) { return new WP_Error( 'convertkit_mcp_resource_permission_callback', __( 'You do not have permission for this operation.', 'convertkit' ) ); } return true; } /** * Returns the arguments array passed to wp_register_ability(). * * @since 3.4.2 * * @return array */ public function get_ability_args() { return array( 'label' => $this->get_label(), 'description' => $this->get_description(), 'category' => $this->get_category(), 'input_schema' => $this->get_input_schema(), 'output_schema' => $this->get_output_schema(), 'permission_callback' => array( $this, 'permission_callback' ), 'execute_callback' => array( $this, 'execute_callback' ), 'meta' => array( 'mcp' => array( 'uri' => $this->get_uri(), 'mimeType' => $this->get_mime_type(), ), ), ); } /** * Execute callback for this resource, returning its content. * * @since 3.4.2 * * @param array $input Resource input. * @return string|WP_Error */ abstract public function execute_callback( $input ); }