Skip to main content
Glama

wp_search_site

Search across posts, pages, and media on a WordPress site to find specific content with comprehensive results and metadata.

Instructions

Performs a site-wide search for content across posts, pages, and media with comprehensive results and metadata.

Usage Examples: • Search everything: wp_search_site --term="WordPress" • Search posts only: wp_search_site --term="tutorial" --type="posts" • Search pages: wp_search_site --term="about" --type="pages" • Search media: wp_search_site --term="logo" --type="media" • Find specific content: wp_search_site --term="contact form"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
termYesThe search term to look for.
typeNoThe type of content to search.

Implementation Reference

  • The handler function that implements the core logic of wp_search_site. It performs the search using the WordPressClient's search method and formats the results as a markdown list.
    public async handleSearchSite(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      try {
        const { term, type } = params as { term: string; type?: "posts" | "pages" | "media" };
        const results = await client.search(term, type ? [type] : undefined);
        if (results.length === 0) {
          return `No results found for "${term}".`;
        }
        const content =
          `Found ${results.length} results for "${term}":\n\n` +
          results.map((r) => `- [${r.type}] **${r.title}**\n  Link: ${r.url}`).join("\n");
        return content;
      } catch (_error) {
        throw new Error(`Failed to perform search: ${getErrorMessage(_error)}`);
      }
    }
  • The tool definition object within SiteTools.getTools() method, which registers the wp_search_site tool including its name, description, input parameters schema, and reference to the handler function.
    {
      name: "wp_search_site",
      description:
        "Performs a site-wide search for content across posts, pages, and media with comprehensive results and metadata.\n\n" +
        "**Usage Examples:**\n" +
        '• Search everything: `wp_search_site --term="WordPress"`\n' +
        '• Search posts only: `wp_search_site --term="tutorial" --type="posts"`\n' +
        '• Search pages: `wp_search_site --term="about" --type="pages"`\n' +
        '• Search media: `wp_search_site --term="logo" --type="media"`\n' +
        '• Find specific content: `wp_search_site --term="contact form"`',
      parameters: [
        {
          name: "term",
          type: "string",
          required: true,
          description: "The search term to look for.",
        },
        {
          name: "type",
          type: "string",
          description: "The type of content to search.",
          enum: ["posts", "pages", "media"],
        },
      ],
      handler: this.handleSearchSite.bind(this),
    },
  • The input parameters schema defining the 'term' (required string) and optional 'type' (enum: posts, pages, media) for the wp_search_site tool.
    parameters: [
      {
        name: "term",
        type: "string",
        required: true,
        description: "The search term to look for.",
      },
      {
        name: "type",
        type: "string",
        description: "The type of content to search.",
        enum: ["posts", "pages", "media"],
      },
    ],
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'comprehensive results and metadata,' which hints at output behavior, but fails to disclose critical traits like whether this is a read-only operation, potential rate limits, authentication needs, or error handling. For a search tool with zero annotation coverage, this leaves significant gaps in behavioral understanding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by usage examples. It's appropriately sized and front-loaded, though the examples could be more concise. Every sentence serves a purpose, but there's slight redundancy in the examples that could be trimmed.

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

Completeness3/5

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

Given the tool's moderate complexity (search with 3 parameters), no annotations, and no output schema, the description is partially complete. It covers the basic purpose and usage but lacks details on output format, error cases, or performance considerations. It's adequate for a simple search tool but could be more comprehensive.

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 already documents all parameters (site, term, type) with clear descriptions. The description adds minimal value beyond the schema, as it only reiterates parameter usage in examples without providing additional syntax or format details. This meets the baseline for high schema coverage.

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 tool performs 'site-wide search for content across posts, pages, and media with comprehensive results and metadata,' which specifies the verb (search) and resources (posts, pages, media). It distinguishes itself from sibling tools like wp_list_posts or wp_list_pages by focusing on search functionality rather than listing, though it doesn't explicitly contrast with all siblings.

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

Usage Guidelines3/5

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

The description includes usage examples that imply when to use this tool (e.g., for searching posts, pages, or media), but it lacks explicit guidance on when to choose this over alternatives like wp_list_posts or wp_seo_keyword_research. The examples provide context but no clear 'when-not' or alternative tool recommendations.

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