MCP prompts

Overview

Control prompts within a specific WordPress MCP server. Select the subject with AAM::api()->mcp_prompts($access_level, $settings). Omit $access_level to use the current user or visitor.

PHP class: AAM_Framework_Service_McpPrompts.

Method reference

Method Purpose
deny($prompt, $server_id) Store a deny rule.
allow($prompt, $server_id) Store an allow rule.
reset($prompt = null, $server_id = null) Remove one rule or all rules for this level.
is_customized($prompt = null, $server_id = null) Check for a direct rule or preference.
is_denied($prompt, $server_id) Check the effective deny decision.
is_allowed($name, $server_id) Check the effective allow decision.

Return values vary by method. Rule updates usually return bool; reads can return a value, null, or an array. Errors follow the service’s error_handling setting and may produce WP_Error.

Accepted identifiers

Pass the prompt name string or a prompt object with getName(), followed by its server ID: deny('review_content', 'my-server'). The server ID is required because the same prompt name can occur in different servers. reset() and is_customized() allow omitted arguments to address a broader set of rules.

Example

$prompts = AAM::api()->mcp_prompts('role:subscriber');
$prompts->deny('private-summary', 'my-server');
$blocked = $prompts->is_denied('private-summary', 'my-server');

This denies the private-summary prompt on my-server for Subscribers. $blocked reads that prompt’s effective access decision.

Developer notes

Behavior and parameters