Skip to main content
Glama

get-stats-summary

Access summarized statistics for views, visitors, likes, and comments on a WordPress site by providing site URL, ID, username, and application password.

Instructions

View a site's summarized views, visitors, likes and comments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
passwordYesWordPress application password
siteIdYesWordPress site ID
siteUrlYesWordPress site URL
usernameYesWordPress username

Implementation Reference

  • Full implementation of the get-stats-summary tool, including registration, input schema, and handler logic. Fetches summarized views, visitors, likes, and comments from the WordPress stats API endpoint `sites/{siteId}/stats/summary` and formats the data into a readable text response.
      "get-stats-summary",
      "View a site's summarized views, visitors, likes and comments",
      {
        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"),
      },
      async ({ siteUrl, username, password, siteId }) => {
        try {
          const summary = await makeWPRequest<WPStatsSummary>({
            siteUrl,
            endpoint: `sites/${siteId}/stats/summary`,
            auth: { username, password }
          });
          
          const summaryText = `
    Stats Summary for site #${siteId}:
    
    Views:
    Total: ${summary.views?.total || 0}
    ${summary.views?.fields?.map(f => `${f.period}: ${f.value}`).join('\n') || "No data"}
    
    Visitors:
    Total: ${summary.visitors?.total || 0}
    ${summary.visitors?.fields?.map(f => `${f.period}: ${f.value}`).join('\n') || "No data"}
    
    Likes:
    Total: ${summary.likes?.total || 0}
    ${summary.likes?.fields?.map(f => `${f.period}: ${f.value}`).join('\n') || "No data"}
    
    Comments:
    Total: ${summary.comments?.total || 0}
    ${summary.comments?.fields?.map(f => `${f.period}: ${f.value}`).join('\n') || "No data"}
          `.trim();
          
          return {
            content: [
              {
                type: "text",
                text: summaryText,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error retrieving stats summary: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • TypeScript interface defining the structure of the WPStatsSummary response used by the get-stats-summary tool handler.
    interface WPStatsSummary {
      visitors: {
        total: number;
        fields: Array<{period: string; value: number}>;
      };
      views: {
        total: number;
        fields: Array<{period: string; value: number}>;
      };
      likes: {
        total: number;
        fields: Array<{period: string; value: number}>;
      };
      comments: {
        total: number;
        fields: Array<{period: string; value: number}>;
      };
    }
  • Helper function makeWPRequest used by the get-stats-summary handler to make authenticated requests to the WordPress REST API.
    async function makeWPRequest<T>({
      siteUrl, 
      endpoint,
      method = 'GET',
      auth,
      data = null,
      params = null
    }: {
      siteUrl: string;
      endpoint: string;
      method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
      auth: { username: string; password: string };
      data?: any;
      params?: any;
    }): Promise<T> {
      const authString = Buffer.from(`${auth.username}:${auth.password}`).toString('base64');
      
      try {
        const response = await axios({
          method,
          url: `${siteUrl}/wp-json/wp/v2/${endpoint}`,
          headers: {
            'Authorization': `Basic ${authString}`,
            'Content-Type': 'application/json',
          },
          data: data,
          params: params
        });
        
        return response.data as T;
      } catch (error) {
        if (axios.isAxiosError(error) && error.response) {
          throw new Error(`WordPress API error: ${error.response.data?.message || error.message}`);
        }
        throw 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 this is a 'View' operation (implying read-only), but doesn't mention authentication requirements, rate limits, error conditions, or what the summarized output looks like. For a tool with 4 required parameters and no annotations, this leaves significant behavioral gaps.

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 states the core purpose without unnecessary words. It's appropriately sized for a straightforward retrieval tool and gets directly to the point.

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

Completeness2/5

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

For a tool with 4 required authentication parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the summarized statistics include, how they're formatted, or provide any context about the WordPress API integration. The agent would need to guess about the output structure and behavioral characteristics.

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 all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete.

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 action ('View') and the resource ('a site's summarized views, visitors, likes and comments'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from similar sibling tools like 'get-site-stats' or 'get-post-stats', which might offer overlapping functionality.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get-site-stats' or 'get-post-stats'. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name and parameters 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