Skip to main content
Glama

wp_update_site_settings

Modify WordPress site settings including title, description, and timezone through the MCP WordPress Server to customize site configuration.

Instructions

Updates one or more general settings for a WordPress site.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
titleNoThe title of the site.
descriptionNoThe tagline or description of the site.
timezoneNoA city in the same timezone, e.g., 'America/New_York'.

Implementation Reference

  • The MCP tool handler function that receives parameters, calls WordPressClient.updateSiteSettings, and returns a formatted success message or throws an error.
    public async handleUpdateSiteSettings(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      try {
        const updatedSettings = await client.updateSiteSettings(params);
        return `✅ Site settings updated successfully. New title: ${updatedSettings.title}`;
      } catch (_error) {
        throw new Error(`Failed to update site settings: ${getErrorMessage(_error)}`);
      }
    }
  • Tool registration object within SiteTools.getTools() array, defining name, description, input parameters schema, and handler binding.
    {
      name: "wp_update_site_settings",
      description: "Updates one or more general settings for a WordPress site.",
      parameters: [
        {
          name: "title",
          type: "string",
          description: "The title of the site.",
        },
        {
          name: "description",
          type: "string",
          description: "The tagline or description of the site.",
        },
        {
          name: "timezone",
          type: "string",
          description: "A city in the same timezone, e.g., 'America/New_York'.",
        },
      ],
      handler: this.handleUpdateSiteSettings.bind(this),
    },
  • Dynamic registration of all tool classes (including SiteTools) by instantiating them, calling getTools(), and registering each tool with the MCP server.
    Object.values(Tools).forEach((ToolClass) => {
      let toolInstance: { getTools(): unknown[] };
    
      // Cache and Performance tools need the clients map
      if (ToolClass.name === "CacheTools" || ToolClass.name === "PerformanceTools") {
        toolInstance = new ToolClass(this.wordpressClients);
      } else {
        toolInstance = new (ToolClass as new () => { getTools(): unknown[] })();
      }
    
      const tools = toolInstance.getTools();
    
      tools.forEach((tool: unknown) => {
        this.registerTool(tool as ToolDefinition);
      });
    });
  • TypeScript interface defining the structured input parameters for the wp_update_site_settings tool.
    export interface UpdateSiteSettingsParams extends BaseToolParams {
      readonly title?: string;
      readonly description?: string;
      readonly url?: string;
      readonly email?: string;
      readonly timezone?: string;
      readonly date_format?: string;
      readonly time_format?: string;
      readonly start_of_week?: number;
      readonly language?: string;
      readonly use_smilies?: boolean;
      readonly default_category?: CategoryId;
      readonly default_post_format?: string;
      readonly posts_per_page?: number;
      readonly default_ping_status?: PingStatus;
      readonly default_comment_status?: CommentStatus;
    }
  • Core helper function in SiteOperations that performs the actual POST request to the WordPress REST API /settings endpoint to update site settings.
    async updateSiteSettings(settings: Partial<WordPressSiteSettings>): Promise<WordPressSiteSettings> {
      return this.client.post<WordPressSiteSettings>("settings", settings);
    }

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