Skip to main content
Glama

wp_switch_auth_method

Change authentication methods for WordPress site sessions to use app passwords, basic credentials, or JWT tokens as needed.

Instructions

Switches the authentication method for a site for the current session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
methodYesThe new authentication method to use.
usernameNoThe username for 'app-password' or 'basic' authentication.
passwordNoThe Application Password for 'app-password' or password for 'basic' auth.
jwt_tokenNoThe token for 'jwt' authentication.

Implementation Reference

  • The handler function that executes the 'wp_switch_auth_method' tool logic. Currently throws an error stating that dynamic authentication method switching is not supported.
    public async handleSwitchAuthMethod(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      const {
        method: _method,
        username: _username,
        password: _password,
        jwt_token: _jwt_token,
      } = params as {
        method: AuthMethod;
        username?: string;
        password?: string;
        jwt_token?: string;
      };
      try {
        // This functionality is not currently supported as the client
        // doesn't have an updateAuthConfig method
        throw new Error(
          "Dynamic authentication method switching is not currently supported. Please update your configuration file and restart the server.",
        );
      } catch (_error) {
        throw new Error(`Failed to switch auth method: ${getErrorMessage(_error)}`);
      }
    }
  • Registers the 'wp_switch_auth_method' tool in the AuthTools.getTools() array, including its name, description, input parameters schema, and handler binding.
    {
      name: "wp_switch_auth_method",
      description: "Switches the authentication method for a site for the current session.",
      parameters: [
        {
          name: "method",
          type: "string",
          required: true,
          description: "The new authentication method to use.",
          enum: ["app-password", "jwt", "basic", "api-key", "cookie"],
        },
        {
          name: "username",
          type: "string",
          description: "The username for 'app-password' or 'basic' authentication.",
        },
        {
          name: "password",
          type: "string",
          description: "The Application Password for 'app-password' or password for 'basic' auth.",
        },
        {
          name: "jwt_token",
          type: "string",
          description: "The token for 'jwt' authentication.",
        },
      ],
      handler: this.handleSwitchAuthMethod.bind(this),
    },
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral context. It mentions 'for the current session', implying temporary changes, but doesn't cover critical aspects like required permissions, whether changes persist, error conditions, or what happens to existing auth tokens. For a security-sensitive tool, this is inadequate.

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 a single, efficient sentence with zero waste. It's front-loaded with the core purpose and includes a useful scope qualifier ('for the current session'). Every word earns its place.

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

Completeness2/5

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

For a tool that modifies authentication (a security-critical operation) with no annotations and no output schema, the description is incomplete. It lacks details on behavioral impact, success/failure responses, and how it interacts with sibling auth tools. The conciseness comes at the cost of necessary context.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no additional parameter semantics beyond implying the 'method' parameter is required (matching schema). Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('switches') and resource ('authentication method for a site'), with the scope 'for the current session' adding specificity. It doesn't explicitly differentiate from sibling tools like 'wp_test_auth' or 'wp_get_auth_status', but the purpose is unambiguous.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing to test auth first), exclusions, or compare to sibling tools like 'wp_test_auth' for validation or 'wp_get_auth_status' for checking current state.

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/docdyhr/mcp-wordpress'

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