Skip to main content
Glama

get-search-terms

Analyze search terms used to find a WordPress site by specifying the site URL, credentials, and time period. Retrieve up to 100 terms for insights into visitor search behavior.

Instructions

View search terms used to find the site

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of search terms to return
passwordYesWordPress application password
periodNoTime period for stats
siteIdYesWordPress site ID
siteUrlYesWordPress site URL
usernameYesWordPress username

Implementation Reference

  • Handler function that makes an API request to the WordPress site's Jetpack stats endpoint for search terms, processes the response data, formats it into a readable text output, and returns it as MCP content or an error message.
      async ({ siteUrl, username, password, siteId, period = "week", limit = 10 }) => {
        try {
          const searchData = await makeWPRequest<any>({
            siteUrl,
            endpoint: `sites/${siteId}/stats/search-terms`,
            auth: { username, password },
            params: { period, limit }
          });
          
          const searchTermsText = Array.isArray(searchData.search_terms) && searchData.search_terms.length > 0
            ? searchData.search_terms.map((term: any) => 
                `"${term.term || "Unknown"}"
    Views: ${term.views || 0}
    ---`
              ).join("\n")
            : "No search terms found or search terms are encrypted";
          
          return {
            content: [
              {
                type: "text",
                text: `Search Terms for site #${siteId} (${period}):\n\n${searchTermsText}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error retrieving search terms: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
  • Zod schema defining the input parameters for the get-search-terms tool, including required credentials, site details, and optional period and limit for the stats query.
    {
      siteUrl: z.string().url().describe("WordPress site URL"),
      username: z.string().describe("WordPress username"),
      password: z.string().describe("WordPress application password"),
      siteId: z.number().describe("WordPress site ID"),
      period: z.enum(["day", "week", "month", "year"]).optional().describe("Time period for stats"),
      limit: z.number().min(1).max(100).optional().describe("Maximum number of search terms to return"),
    },
  • src/index.ts:1653-1700 (registration)
    Registration of the 'get-search-terms' tool using McpServer.tool(), including the tool name, description, input schema, and handler function reference.
    server.tool(
      "get-search-terms",
      "View search terms used to find the site",
      {
        siteUrl: z.string().url().describe("WordPress site URL"),
        username: z.string().describe("WordPress username"),
        password: z.string().describe("WordPress application password"),
        siteId: z.number().describe("WordPress site ID"),
        period: z.enum(["day", "week", "month", "year"]).optional().describe("Time period for stats"),
        limit: z.number().min(1).max(100).optional().describe("Maximum number of search terms to return"),
      },
      async ({ siteUrl, username, password, siteId, period = "week", limit = 10 }) => {
        try {
          const searchData = await makeWPRequest<any>({
            siteUrl,
            endpoint: `sites/${siteId}/stats/search-terms`,
            auth: { username, password },
            params: { period, limit }
          });
          
          const searchTermsText = Array.isArray(searchData.search_terms) && searchData.search_terms.length > 0
            ? searchData.search_terms.map((term: any) => 
                `"${term.term || "Unknown"}"
    Views: ${term.views || 0}
    ---`
              ).join("\n")
            : "No search terms found or search terms are encrypted";
          
          return {
            content: [
              {
                type: "text",
                text: `Search Terms for site #${siteId} (${period}):\n\n${searchTermsText}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error retrieving search terms: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'view' which implies a read-only operation, but doesn't disclose authentication needs (though implied by required parameters), rate limits, data format, pagination, or what happens if parameters are invalid. For a tool with 6 parameters including authentication, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It's appropriately sized for a simple tool, with zero waste or redundancy, making it easy for an agent to parse quickly.

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 (6 parameters including authentication), no annotations, and no output schema, the description is minimally adequate but incomplete. It states what the tool does but lacks behavioral context, usage guidance, and output details, which are needed for the agent to use it effectively in a WordPress stats context.

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 thoroughly. The description doesn't add any meaning beyond what the schema provides—it doesn't explain how parameters interact (e.g., that 'period' affects the search terms returned) or provide usage examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 'View search terms used to find the site' clearly states the verb ('view') and resource ('search terms'), specifying it's about terms used to find the site. It distinguishes from siblings like 'get-clicks' or 'get-referrers' by focusing on search terms, though it doesn't explicitly differentiate from similar tools like 'get-site-stats' which might overlap.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention when to choose it over other stats-related tools like 'get-site-stats' or 'get-stats-summary', nor does it specify prerequisites or exclusions, leaving the agent to infer usage from context alone.

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

Related 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/prathammanocha/wordpress-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server