Skip to main content
Glama

list_decoders

Retrieve a list of Wazuh decoders with optional filtering by name, pagination, and sorting to manage detection rules efficiently.

Instructions

List all available Wazuh decoders with optional name filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoFilter by decoder name
limitNoMaximum number of decoders to return (1-100)
offsetNoPagination offset
sortNoSort field with direction prefix (e.g., '-name')

Implementation Reference

  • The async handler function that calls client.getDecoders, maps the response, and returns formatted JSON result.
    async ({ name, limit, offset, sort }) => {
      try {
        const params: Record<string, string | number> = { limit, offset };
        if (name) params.name = name;
        if (sort) params.sort = sort;
    
        const response = await client.getDecoders(params);
        const data = response.data;
    
        const result = {
          decoders: data.affected_items.map((decoder) => ({
            name: decoder.name,
            filename: decoder.filename,
            relative_dirname: decoder.relative_dirname,
            status: decoder.status,
            position: decoder.position,
            details: decoder.details,
          })),
          total: data.total_affected_items,
          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,
        };
      }
    }
  • Registers the 'list_decoders' tool with MCP server, defining input schema (name, limit, offset, sort) and the handler.
    server.tool(
      "list_decoders",
      "List all available Wazuh decoders with optional name filtering",
      {
        name: z
          .string()
          .optional()
          .describe("Filter by decoder name"),
        limit: z
          .number()
          .int()
          .min(1)
          .max(100)
          .default(10)
          .describe("Maximum number of decoders to return (1-100)"),
        offset: z
          .number()
          .int()
          .min(0)
          .default(0)
          .describe("Pagination offset"),
        sort: z
          .string()
          .optional()
          .describe("Sort field with direction prefix (e.g., '-name')"),
      },
      async ({ name, limit, offset, sort }) => {
        try {
          const params: Record<string, string | number> = { limit, offset };
          if (name) params.name = name;
          if (sort) params.sort = sort;
    
          const response = await client.getDecoders(params);
          const data = response.data;
    
          const result = {
            decoders: data.affected_items.map((decoder) => ({
              name: decoder.name,
              filename: decoder.filename,
              relative_dirname: decoder.relative_dirname,
              status: decoder.status,
              position: decoder.position,
              details: decoder.details,
            })),
            total: data.total_affected_items,
            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 for 'list_decoders' input: optional name filter, limit (1-100, default 10), offset (default 0), optional sort.
    {
      name: z
        .string()
        .optional()
        .describe("Filter by decoder name"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(10)
        .describe("Maximum number of decoders to return (1-100)"),
      offset: z
        .number()
        .int()
        .min(0)
        .default(0)
        .describe("Pagination offset"),
      sort: z
        .string()
        .optional()
        .describe("Sort field with direction prefix (e.g., '-name')"),
    },
  • Client method getDecoders that makes the GET /decoders API call with params.
    async getDecoders(
      params: Record<string, string | number> = {}
    ): Promise<WazuhApiResponse<WazuhPaginatedData<WazuhDecoder>>> {
      return this.get("/decoders", params);
    }
  • Type definition for WazuhDecoder interface used to type the response.
    export interface WazuhDecoder {
      name: string;
      details?: Record<string, unknown>;
      filename?: string;
      relative_dirname?: string;
      status?: string;
      position?: number;
    }
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states the purpose and optional name filtering, lacking details on pagination behavior (despite parameters), idempotency, or any side effects. This is insufficient for a read operation.

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 a single, front-loaded sentence that conveys the core functionality efficiently. It could be slightly expanded without becoming verbose, but it is concise and to the point.

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?

The tool has no output schema and the description does not explain return values or behavior beyond listing. While parameters are documented in the schema, the lack of information about what is returned (e.g., full decoder objects) or default sorting makes it adequate but not complete.

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% (all 4 parameters have descriptions). The tool description adds 'optional name filtering', which duplicates the schema parameter description. It provides no additional meaning, so the baseline score of 3 is appropriate.

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 tool lists all available decoders with optional name filtering. It uses a specific verb 'list' and resource 'decoders', and differentiates from sibling list tools (e.g., list_agents, list_rules) by specifying the object type.

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 implies usage for listing decoders, optionally by name, but does not provide guidance on when to prefer this tool over alternatives or when not to use it. Given multiple sibling list tools, clearer usage context would improve clarity.

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