wp_get_application_passwords
Retrieve application passwords for a WordPress user to manage API access and security permissions. Lists all assigned passwords for user authentication.
Instructions
Lists application passwords for a specific user.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | The ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured. | |
| user_id | Yes | The ID of the user to get application passwords for. |
Implementation Reference
- src/tools/site.ts:82-94 (registration)Registration of the wp_get_application_passwords tool including schema (parameters) in SiteTools.getTools(){ name: "wp_get_application_passwords", description: "Lists application passwords for a specific user.", parameters: [ { name: "user_id", type: "number", required: true, description: "The ID of the user to get application passwords for.", }, ], handler: this.handleGetApplicationPasswords.bind(this), },
- src/tools/site.ts:219-241 (handler)Handler function that executes the tool: extracts user_id, calls client.getApplicationPasswords, formats and returns the list of application passwords.public async handleGetApplicationPasswords( client: WordPressClient, params: Record<string, unknown>, ): Promise<unknown> { try { const { user_id } = params as { user_id: number }; const passwords = await client.getApplicationPasswords(user_id); if (passwords.length === 0) { return `No application passwords found for user ID ${user_id}.`; } const content = `Found ${passwords.length} application passwords for user ID ${user_id}:\n\n` + passwords .map( (p: WordPressApplicationPassword) => `- **${p.name}** (UUID: ${p.uuid})\n Created: ${new Date(p.created).toLocaleDateString()}`, ) .join("\n"); return content; } catch (_error) { throw new Error(`Failed to get application passwords: ${getErrorMessage(_error)}`); } }
- src/client/operations/site.ts:53-55 (helper)Supporting method in SiteOperations that makes the actual REST API GET request to retrieve application passwords for the user.async getApplicationPasswords(userId: number | "me" = "me"): Promise<WordPressApplicationPassword[]> { return this.client.get<WordPressApplicationPassword[]>(`users/${userId}/application-passwords`); }