# convertkit/3.4.4/includes/mcp/abilities/settings/class-convertkit-mcp-ability-settings-get.php

Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages, version 3.4.4. 149 lines.

- Page: https://pluginprobe.com/plugins/convertkit/3.4.4/code/includes/mcp/abilities/settings/class-convertkit-mcp-ability-settings-get.php
- Raw: https://pluginprobe.com/plugins/convertkit/3.4.4/raw/includes/mcp/abilities/settings/class-convertkit-mcp-ability-settings-get.php
- Modified: 2026-08-28T10:49:42+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/convertkit/3.4.4/code/includes/mcp/abilities/settings/class-convertkit-mcp-ability-settings-get.php#L10-L20`.

```php
<?php
/**
 * Kit MCP Ability: Get Settings.
 *
 * @package ConvertKit
 * @author ConvertKit
 */

/**
 * Ability that returns the current values of a Kit settings group.
 *
 * Produces an ability named `kit/settings-<name>-get` (e.g. `kit/settings-general-get`).
 *
 * @package ConvertKit
 * @author  ConvertKit
 */
class ConvertKit_MCP_Ability_Settings_Get extends ConvertKit_MCP_Ability_Settings {

	/**
	 * Sets whether the ability is readonly.
	 *
	 * @since   3.4.0
	 *
	 * @var     bool
	 */
	private $readonly = true; // @phpstan-ignore-line

	/**
	 * Sets whether the ability is idempotent.
	 *
	 * @since   3.4.0
	 *
	 * @var     bool
	 */
	private $idempotent = true; // @phpstan-ignore-line

	/**
	 * Returns the operation suffix used in the ability name.
	 *
	 * @since   3.4.0
	 *
	 * @return  string
	 */
	protected function get_operation() {

		return 'get';

	}

	/**
	 * Returns the ability's human-readable label.
	 *
	 * @since   3.4.0
	 *
	 * @return  string
	 */
	public function get_label() {

		return sprintf(
			/* translators: %s: Settings Title, e.g. 'General Settings'. */
			__( 'Get Kit Plugin %s', 'convertkit' ),
			$this->settings->get_title()
		);

	}

	/**
	 * Returns the ability's human-readable description.
	 *
	 * @since   3.4.0
	 *
	 * @return  string
	 */
	public function get_description() {

		return sprintf(
			/* translators: %s: Settings Title, e.g. 'General Settings'. */
			__( 'Returns the current values of the Kit Plugin "%s".', 'convertkit' ),
			$this->settings->get_title()
		);

	}

	/**
	 * Returns the ability's input JSON Schema.
	 *
	 * Get takes no input.
	 *
	 * @since   3.4.0
	 *
	 * @return  array
	 */
	public function get_input_schema() {

		return array(
			'type'       => 'object',
			'properties' => new stdClass(),
		);

	}

	/**
	 * Returns the ability's output JSON Schema.
	 *
	 * @since   3.4.0
	 *
	 * @return  array
	 */
	public function get_output_schema() {

		return $this->get_public_schema();

	}

	/**
	 * Executes the ability: returns the current settings, scoped to the keys
	 * declared in the public schema.
	 *
	 * Stored values are sanitised through the property schema before being
	 * returned, so the response matches the declared types (e.g. a numeric
	 * setting stored as the string "0.5" is returned as 0.5).
	 *
	 * @since   3.4.0
	 *
	 * @param   array $input   Ability input (unused).
	 * @return  array|WP_Error
	 */
	public function execute_callback( $input ) {

		$values = $this->settings->get();
		$schema = $this->get_public_schema();
		$result = array();

		if ( ! isset( $schema['properties'] ) || ! is_array( $schema['properties'] ) ) {
			return $result;
		}

		foreach ( $schema['properties'] as $key => $property_schema ) {
			if ( array_key_exists( $key, $values ) ) {
				$result[ $key ] = rest_sanitize_value_from_schema( $values[ $key ], $property_schema, $key );
			}
		}

		return $result;

	}

}

```
