wpnav_list_themes
Retrieve installed WordPress themes with details like name, version, and status to manage them effectively using the WP Navigator MCP server.
Instructions
List all installed WordPress themes. Returns theme identifier in "stylesheet" field (use this exact value for get/activate/delete operations), name, version, and status (active/inactive). Stylesheet is typically a lowercase hyphenated name (e.g., "twentytwentyfour", "developer-starter").
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Optional filter by status (e.g., "active" or "inactive"). If omitted or set to "all", returns all themes. |
Implementation Reference
- src/tools/themes/index.ts:35-48 (handler)The handler function executes the tool logic: builds query string for optional status filter, fetches themes via context.wpRequest to WP REST API endpoint /wp/v2/themes, and returns clamped JSON text response.handler: async (args, context) => { const params = new URLSearchParams(); if (args.status && args.status !== 'all') { params.append('status', args.status); } const qs = params.toString(); const endpoint = qs ? `/wp/v2/themes?${qs}` : '/wp/v2/themes'; const themes = await context.wpRequest(endpoint); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(themes, null, 2)) }], }; },
- src/tools/themes/index.ts:27-33 (schema)Input schema defining the optional 'status' parameter for filtering by active/inactive themes.inputSchema: { type: 'object', properties: { status: { type: 'string', description: 'Optional filter by status (e.g., "active" or "inactive"). If omitted or set to "all", returns all themes.' }, }, required: [], },
- src/tools/themes/index.ts:23-50 (registration)The toolRegistry.register call that registers wpnav_list_themes with its full definition (name, description), inputSchema, handler, and category.toolRegistry.register({ definition: { name: 'wpnav_list_themes', description: 'List all installed WordPress themes. Returns theme identifier in "stylesheet" field (use this exact value for get/activate/delete operations), name, version, and status (active/inactive). Stylesheet is typically a lowercase hyphenated name (e.g., "twentytwentyfour", "developer-starter").', inputSchema: { type: 'object', properties: { status: { type: 'string', description: 'Optional filter by status (e.g., "active" or "inactive"). If omitted or set to "all", returns all themes.' }, }, required: [], }, }, handler: async (args, context) => { const params = new URLSearchParams(); if (args.status && args.status !== 'all') { params.append('status', args.status); } const qs = params.toString(); const endpoint = qs ? `/wp/v2/themes?${qs}` : '/wp/v2/themes'; const themes = await context.wpRequest(endpoint); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(themes, null, 2)) }], }; }, category: ToolCategory.THEMES, });
- src/tools/index.ts:30-30 (registration)Invocation of registerThemeTools() within registerAllTools(), which triggers registration of all theme tools including wpnav_list_themes.registerThemeTools();