Skip to main content
Glama

report-referrer-spam

Identify and report spam referrer domains to clean up traffic analytics and enhance website security on WordPress sites. Submit domain details securely via REST API.

Instructions

Report a referrer as spam

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to report as spam
passwordYesWordPress application password
siteIdYesWordPress site ID
siteUrlYesWordPress site URL
usernameYesWordPress username

Implementation Reference

  • src/index.ts:1517-1557 (registration)
    Registration of the 'report-referrer-spam' MCP tool, including description, input schema using Zod, and inline handler function.
    server.tool(
      "report-referrer-spam",
      "Report a referrer as spam",
      {
        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"),
        domain: z.string().describe("Domain to report as spam"),
      },
      async ({ siteUrl, username, password, siteId, domain }) => {
        try {
          const response = await makeWPRequest<any>({
            siteUrl,
            endpoint: `sites/${siteId}/stats/referrers/spam/new`,
            method: "POST",
            auth: { username, password },
            data: { domain }
          });
          
          return {
            content: [
              {
                type: "text",
                text: `Successfully reported domain "${domain}" as spam.`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error reporting referrer as spam: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • The handler function executes a POST request to the WordPress stats API endpoint `/sites/{siteId}/stats/referrers/spam/new` with the domain, using the shared makeWPRequest helper, and returns success or error message.
    async ({ siteUrl, username, password, siteId, domain }) => {
      try {
        const response = await makeWPRequest<any>({
          siteUrl,
          endpoint: `sites/${siteId}/stats/referrers/spam/new`,
          method: "POST",
          auth: { username, password },
          data: { domain }
        });
        
        return {
          content: [
            {
              type: "text",
              text: `Successfully reported domain "${domain}" as spam.`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error reporting referrer as spam: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod schema for input parameters required by the tool.
    {
      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"),
      domain: z.string().describe("Domain to report as spam"),
    },
  • Shared helper function used by the tool (and all others) to make authenticated requests to 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 the action but doesn't explain what 'reporting' entails—e.g., whether it's a read-only action, if it triggers notifications, requires specific permissions, or has side effects like logging or alerts. This leaves critical behavioral traits unspecified.

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, direct sentence with no wasted words, making it highly concise and front-loaded. It immediately conveys the core purpose without unnecessary elaboration, which is efficient for agent comprehension.

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?

Given the tool's complexity (a mutation action with 5 required parameters), no annotations, and no output schema, the description is insufficient. It doesn't cover behavioral aspects, output expectations, or error handling, leaving significant gaps for the agent to operate effectively in this 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 fully documents all 5 parameters. The description adds no additional meaning beyond the schema, such as explaining the relationship between parameters or usage context. This meets the baseline of 3, as the schema handles the heavy lifting without description enhancement.

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 ('Report') and the target ('a referrer as spam'), which is specific and unambiguous. However, it doesn't differentiate from its sibling 'remove-referrer-spam', which likely handles removal rather than reporting, leaving room for confusion about their distinct roles.

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 like 'remove-referrer-spam' or other referrer-related tools. The description lacks context about prerequisites, such as needing authentication or when reporting is appropriate versus removal, leaving the agent without usage direction.

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