Skip to main content
Glama

wpnav_introspect

Discover WordPress API capabilities and configuration details to understand available actions before managing content through natural language commands.

Instructions

Get WP Navigator Pro API capabilities, policy configuration, and environment hints. Call this first to understand what the API can do.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Full registration and handler implementation for the wpnav_introspect tool. Fetches data from the WPNav introspect endpoint, active plugins, current user capabilities, discovers available cookbooks and roles based on active plugins, determines recommended role, and returns a comprehensive JSON response with API capabilities, policies, and environment hints.
    toolRegistry.register({
      definition: {
        name: 'wpnav_introspect',
        description:
          'Get WP Navigator Pro API capabilities, policy configuration, and environment hints. Call this first to understand what the API can do.',
        inputSchema: {
          type: 'object',
          properties: {},
          required: [],
        },
      },
      handler: async (args, context) => {
        const { wpRequest, config } = context;
    
        // Fetch introspect, active plugins, and current user in parallel
        const [introspectData, wpPlugins, currentUser] = await Promise.all([
          wpRequest(config.wpnavIntrospect),
          wpRequest('/wp/v2/plugins?status=active').catch(() => []),
          wpRequest('/wp/v2/users/me').catch(() => null),
        ]);
    
        // Discover available cookbooks and roles
        const { cookbooks } = discoverCookbooks();
        const { roles: rolesMap } = discoverRoles();
    
        // Extract active plugin slugs from WordPress response
        // WordPress plugin slugs are in format "plugin-dir/plugin-file.php"
        const pluginArray = Array.isArray(wpPlugins) ? wpPlugins : [];
        const activePluginSlugs = new Set(
          pluginArray.map((p: { plugin?: string }) => {
            const pluginFile = p.plugin || '';
            return pluginFile.split('/')[0] || pluginFile;
          })
        );
    
        // Build available_cookbooks array
        const availableCookbooks = Array.from(cookbooks.entries()).map(([slug, cookbook]) => {
          const skillCookbook = cookbook as LoadedSkillCookbook;
          return {
            slug,
            description: skillCookbook.skillFrontmatter?.description || null,
            detected: activePluginSlugs.has(slug),
          };
        });
    
        // Build available_roles array and determine recommended role
        const availableRoles = Array.from(rolesMap.keys()).sort();
    
        // Determine recommended role based on WordPress user capabilities
        const userRoles: string[] = (currentUser as any)?.roles || [];
        let recommendedRole = 'content-editor'; // Safe default
    
        if (userRoles.includes('administrator')) {
          recommendedRole = 'site-admin';
        } else if (userRoles.includes('editor')) {
          recommendedRole = 'content-editor';
        } else if (userRoles.includes('author') || userRoles.includes('contributor')) {
          recommendedRole = 'content-editor';
        }
        // For subscriber or unknown roles, default to content-editor (already set)
    
        // Augment response with cookbook and role discovery
        const response = {
          ...(introspectData as object),
          available_cookbooks: availableCookbooks,
          roles: {
            available: availableRoles,
            recommended: recommendedRole,
            count: availableRoles.length,
          },
        };
    
        return {
          content: [
            {
              type: 'text',
              text: context.clampText(JSON.stringify(response, null, 2)),
            },
          ],
        };
      },
      category: ToolCategory.CORE,
    });
  • Registers wpnav_introspect as a core meta-tool that is directly exposed via the MCP ListTools response and can be called directly via CallToolRequest, unlike other tools which require wpnav_execute.
    const META_TOOLS = new Set([
      'wpnav_introspect',
      'wpnav_search_tools',
      'wpnav_describe_tools',
      'wpnav_execute',
      'wpnav_context',
    ]);
  • Static schema definition for the wpnav_introspect tool, matching the runtime definition used in registration.
    {
      name: 'wpnav_introspect',
      description:
        'Get WP Navigator Pro API capabilities, policy configuration, and environment hints. Call this first to understand what the API can do.',
      inputSchema: {
        type: 'object' as const,
        properties: {},
        required: [],
      },
    },
  • Calls registerCoreTools() which includes registration of wpnav_introspect during server startup.
    export function registerAllTools() {
      registerCoreTools();
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It implies a read-only operation ('Get') but does not disclose behavioral traits like rate limits, authentication requirements, or response format. While it hints at the tool's exploratory nature, it lacks details on what 'capabilities' or 'hints' entail, leaving gaps in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence and follows with a clear usage guideline. Both sentences are essential, with no wasted words, making it efficient and well-structured for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as an introspection endpoint with no annotations or output schema, the description is incomplete. It mentions what information is retrieved but does not explain the format or structure of the returned data (e.g., JSON object, list of capabilities), which could hinder the agent's ability to interpret results effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately does not discuss parameters, focusing instead on the tool's purpose and usage, which aligns with the baseline for tools without parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get') and the resource ('WP Navigator Pro API capabilities, policy configuration, and environment hints'), distinguishing it from siblings like wpnav_execute or wpnav_search_tools. It explicitly mentions what information is retrieved, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Call this first to understand what the API can do.' This directly advises the agent to invoke it before other tools, offering clear context for its role in the workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/littlebearapps/wp-navigator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server