Skip to main content
Glama

search_rules

Search Wazuh detection rules by description text to locate relevant rules. Filter by minimum severity and paginate results for efficient analysis.

Instructions

Search Wazuh rules by description text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesSearch term to match against rule descriptions
limitNoMaximum number of rules to return (1-100)
offsetNoPagination offset
levelNoMinimum severity level filter

Implementation Reference

  • Async handler function for search_rules tool. Takes description, limit, offset, and optional level parameters, calls client.getRules() with a search query, maps the response to a simplified rule format, and returns JSON content or error.
      async ({ description, limit, offset, level }) => {
        try {
          const params: Record<string, string | number> = {
            search: description,
            limit,
            offset,
          };
          if (level !== undefined) params.level = level;
    
          const response = await client.getRules(params);
          const data = response.data;
    
          const result = {
            rules: data.affected_items.map((rule) => ({
              id: rule.id,
              description: rule.description,
              level: rule.level,
              groups: rule.groups,
              pci_dss: rule.pci_dss,
              gdpr: rule.gdpr,
              gpg13: rule.gpg13,
              hipaa: rule.hipaa,
              nist_800_53: rule.nist_800_53,
              tsc: rule.tsc,
              mitre: rule.mitre,
              details: rule.details,
            })),
            total: data.total_affected_items,
            description,
            limit,
            offset,
          };
    
          return {
            content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  error: error instanceof Error ? error.message : String(error),
                }),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Zod schema defining the input parameters for search_rules: description (string), limit (number 1-100, default 10), offset (number 0+, default 0), level (optional number 0+).
    {
      description: z
        .string()
        .describe("Search term to match against rule descriptions"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(10)
        .describe("Maximum number of rules to return (1-100)"),
      offset: z
        .number()
        .int()
        .min(0)
        .default(0)
        .describe("Pagination offset"),
      level: z
        .number()
        .int()
        .min(0)
        .optional()
        .describe("Minimum severity level filter"),
    },
  • Registration of the 'search_rules' tool with the MCP server via server.tool(), with description 'Search Wazuh rules by description text'.
    server.tool(
      "search_rules",
  • src/index.ts:41-41 (registration)
    Top-level registration call: registerRuleTools(server, client) invoked from the main entry point.
    registerRuleTools(server, client);
  • The WazuhClient.getRules() helper method invoked by the handler. Calls this.get('/rules', params) with a search parameter.
    async getRules(
      params: Record<string, string | number> = {}
    ): Promise<WazuhApiResponse<WazuhPaginatedData<WazuhRule>>> {
      return this.get("/rules", params);
    }
Behavior2/5

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

No annotations provided. The description only states purpose; it doesn't disclose behavioral traits like read-only nature, pagination behavior, or response structure. As a search tool, more detail on matching semantics would be beneficial.

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?

Single sentence that is concise and front-loaded. No unnecessary words.

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 has 4 parameters, no output schema, and no annotations, the description is too brief. It lacks details on pagination, filtering behavior, and output format, which are important for an agent to use this tool correctly.

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 explains each parameter. The description adds marginal value by implying the 'description' parameter is used for text matching, but no extra semantics beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action 'search', the resource 'Wazuh rules', and the search criterion 'by description text'. It distinguishes from sibling tools like 'list_rules' and 'get_rule'.

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 on when to use this tool vs alternatives like 'list_rules' or 'get_rule'. No context about when not to use or prerequisites.

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/solomonneas/wazuh-mcp'

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