Skip to main content
Glama

wpnav_delete_theme

Delete an installed WordPress theme that is not currently active. Switch to a different theme first, and ensure no child themes are using it.

Instructions

Delete an installed WordPress theme. The theme must not be active - switch to a different theme first. Cannot delete parent theme while child theme is active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stylesheetYesTheme stylesheet from wpnav_list_themes "stylesheet" field (e.g., "flavor")

Implementation Reference

  • The async handler function that validates the stylesheet parameter and sends a DELETE request to the `/wpnav/v1/themes/{stylesheet}` endpoint to delete the theme. Handles errors including writes_disabled.
    handler: async (args, context) => { try { validateRequired(args, ['stylesheet']); const result = await context.wpRequest(`/wpnav/v1/themes/${args.stylesheet}`, { method: 'DELETE', }); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(result, null, 2)) }], }; } catch (error: any) { const errorMessage = error.message || 'Unknown error'; const isWritesDisabled = errorMessage.includes('WRITES_DISABLED'); return { content: [{ type: 'text', text: JSON.stringify({ error: isWritesDisabled ? 'writes_disabled' : 'operation_failed', code: isWritesDisabled ? 'WRITES_DISABLED' : 'DELETE_FAILED', message: errorMessage, context: { resource_type: 'theme', stylesheet: args.stylesheet, suggestion: isWritesDisabled ? 'Set WPNAV_ENABLE_WRITES=1 in MCP server config (.mcp.json env section)' : 'Check theme is not active and exists with wpnav_list_themes', }, }, null, 2), }], isError: true, }; } },
  • The tool definition including name, description, and inputSchema for validating the 'stylesheet' parameter.
    definition: { name: 'wpnav_delete_theme', description: 'Delete an installed WordPress theme. The theme must not be active - switch to a different theme first. Cannot delete parent theme while child theme is active.', inputSchema: { type: 'object', properties: { stylesheet: { type: 'string', description: 'Theme stylesheet from wpnav_list_themes "stylesheet" field (e.g., "flavor")' }, }, required: ['stylesheet'], }, },
  • The toolRegistry.register call that registers the wpnav_delete_theme tool with its schema, handler, and category.
    toolRegistry.register({ definition: { name: 'wpnav_delete_theme', description: 'Delete an installed WordPress theme. The theme must not be active - switch to a different theme first. Cannot delete parent theme while child theme is active.', inputSchema: { type: 'object', properties: { stylesheet: { type: 'string', description: 'Theme stylesheet from wpnav_list_themes "stylesheet" field (e.g., "flavor")' }, }, required: ['stylesheet'], }, }, handler: async (args, context) => { try { validateRequired(args, ['stylesheet']); const result = await context.wpRequest(`/wpnav/v1/themes/${args.stylesheet}`, { method: 'DELETE', }); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(result, null, 2)) }], }; } catch (error: any) { const errorMessage = error.message || 'Unknown error'; const isWritesDisabled = errorMessage.includes('WRITES_DISABLED'); return { content: [{ type: 'text', text: JSON.stringify({ error: isWritesDisabled ? 'writes_disabled' : 'operation_failed', code: isWritesDisabled ? 'WRITES_DISABLED' : 'DELETE_FAILED', message: errorMessage, context: { resource_type: 'theme', stylesheet: args.stylesheet, suggestion: isWritesDisabled ? 'Set WPNAV_ENABLE_WRITES=1 in MCP server config (.mcp.json env section)' : 'Check theme is not active and exists with wpnav_list_themes', }, }, null, 2), }], isError: true, }; } }, category: ToolCategory.THEMES, });
  • Static tool schema definition exported in tools.ts, likely for MCP tool listing or validation.
    { name: 'wpnav_delete_theme', description: 'Delete a WordPress theme by stylesheet name. Theme must not be active. WARNING: This permanently deletes the theme files.', inputSchema: { type: 'object' as const, properties: { stylesheet: { type: 'string' as const, description: 'Theme stylesheet name (slug)', }, }, required: ['stylesheet'], }, },

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