Skip to main content
Glama

discord_search_messages

Search Discord channel messages by keyword to find specific conversations or information within recent message history.

Instructions

Search messages in a channel by keyword (scans up to last 100 messages).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
keywordYes
limitNoMax messages to scan (default 100).

Implementation Reference

  • The handler implementation for the `discord_search_messages` tool, which fetches recent messages from a channel and filters them by a provided keyword.
    case "discord_search_messages": {
      const channel = await getTextChannel(args.channel_id as string);
      const limit = Math.min(Math.max(Number(args.limit ?? 100), 1), 100);
      const messages = await channel.messages.fetch({ limit });
      const keyword = (args.keyword as string).toLowerCase();
      const matches = [...messages.values()]
        .filter((m) => m.content.toLowerCase().includes(keyword))
        .sort((a, b) => a.createdTimestamp - b.createdTimestamp)
        .map((m) => ({ id: m.id, author: m.author.tag, content: m.content, timestamp: m.createdAt.toISOString() }));
      return { content: [{ type: "text", text: matches.length > 0 ? JSON.stringify(matches, null, 2) : `No messages found containing "${args.keyword}" in the last ${limit} messages.` }] };
    }
  • The schema definition for the `discord_search_messages` tool.
    {
      name: "discord_search_messages",
      description: "Search messages in a channel by keyword (scans up to last 100 messages).",
      inputSchema: {
        type: "object",
        properties: {
          channel_id: { type: "string" },
          keyword: { type: "string" },
          limit: { type: "number", description: "Max messages to scan (default 100)." },
        },
        required: ["channel_id", "keyword"],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses the scan limit ('up to last 100 messages'), which is useful behavioral context. However, it doesn't cover other critical traits: e.g., whether this is a read-only operation (implied but not stated), error conditions, rate limits, or authentication needs. For a search tool with no annotations, this leaves significant 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: 'Search messages in a channel by keyword (scans up to last 100 messages).' It's front-loaded with the core purpose and includes essential behavioral detail in parentheses. Zero waste, perfectly sized for the tool's complexity.

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 no annotations, no output schema, and low schema coverage, the description is minimally complete. It states what the tool does and a key constraint (scan limit), but lacks details on return values, error handling, or deeper usage context. For a simple search tool, this might suffice, but it's borderline adequate.

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 33% (only 'limit' has a description). The description adds minimal param semantics: it mentions 'keyword' and implies 'channel_id' but doesn't explain their formats or constraints. It doesn't compensate for the low coverage, but since there are only 3 parameters and the tool's purpose is straightforward, a baseline 3 is appropriate—adequate but with clear gaps.

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 tool's purpose: 'Search messages in a channel by keyword'. It specifies the verb ('Search'), resource ('messages'), and scope ('in a channel'), making it distinct from siblings like 'discord_read_messages' or 'discord_get_member_info'. However, it doesn't explicitly differentiate from other search-related tools (none listed), so it's not a perfect 5.

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 by mentioning 'scans up to last 100 messages', suggesting it's for recent message searches. No explicit guidance on when to use this vs. alternatives like 'discord_read_messages' (which might fetch all messages) or other filtering methods is provided. It's adequate but lacks clear exclusions or named alternatives.

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/PaSympa/discord-mcp'

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