Skip to main content
Glama

discord_search_messages

Read-only

Search recent messages in a Discord channel or thread by keyword using case-insensitive substring matching, scanning up to the last 100 messages.

Instructions

Keyword search over a channel's recent messages using case-insensitive substring matching. Scans only up to the last 100 messages; it does not search full history. Returns { matches: [...] } with id, author, content, timestamp, and the text of any embeds. Matching checks message content only, so a word that appears only in an embed is not found. Requires the View Channel and Read Message History permissions; without Read Message History an empty scan fails with an error naming the permission. Use discord_read_messages to fetch recent messages without filtering. To search full history, in one channel or the whole server, use discord_search_guild_messages.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "channel_id": "<channel_id>",
      "keyword": "<keyword>"
    },
    "name": "discord_search_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMax number of recent messages to scan (1–100). Default 100.
keywordYesCase-insensitive substring to match within message content.
channel_idYesID (snowflake) of the channel or thread to search.

Output Schema

NameRequiredDescriptionDefault
matchesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv2.3.0
    • addedOutput schema / properties / matches / items / properties / author_id
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / matches / items / properties / webhook_id
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / properties / matches / items / required
      Previous value: -[
      -  "id",
      -  "author",
      -  "content",
      -  "timestamp"
      -]New value: +[
      +  "id",
      +  "author",
      +  "author_id",
      +  "content",
      +  "timestamp"
      +]
  2. Changed1 schema field changedv2.2.1
    • addedOutput schema / properties / matches / items / properties / embeds
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "author": {
      +        "type": "string"
      +      },
      +      "description": {
      +        "type": "string"
      +      },
      +      "fields": {
      +        "items": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "name": {
      +              "type": "string"
      +            },
      +            "value": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "name",
      +            "value"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "footer": {
      +        "type": "string"
      +      },
      +      "moreFields": {
      +        "description": "Count of fields left out past the first 10. Absent when none were.",
      +        "type": "number"
      +      },
      +      "title": {
      +        "type": "string"
      +      },
      +      "url": {
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  3. Changed1 schema field changedv2.2.0
    • addedInput schema / additionalProperties
      Added value: +false
  4. Changed6 schema fields changedv2.0.0
    • addedInput schema / properties / channel_id / pattern
      Added value: +"^\\d{17,20}$"
    • addedInput schema / properties / limit / default
      Added value: +100
    • addedInput schema / properties / limit / maximum
      Added value: +100
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • changedInput schema / properties / limit / type
      Previous value: -"number"New value: +"integer"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "matches": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "author": {
      +            "type": "string"
      +          },
      +          "content": {
      +            "type": "string"
      +          },
      +          "id": {
      +            "type": "string"
      +          },
      +          "timestamp": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "id",
      +          "author",
      +          "content",
      +          "timestamp"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "matches"
      +  ],
      +  "type": "object"
      +}
  5. Changed3 schema fields changedv1.6.0
    • addedInput schema / properties / channel_id / description
      Added value: +"ID (snowflake) of the channel or thread to search."
    • addedInput schema / properties / keyword / description
      Added value: +"Case-insensitive substring to match within message content."
    • changedInput schema / properties / limit / description
      Previous value: -"Max messages to scan (default 100)."New value: +"Max number of recent messages to scan (1–100). Default 100."
  6. Addedv1.5.0
  7. Removedv1.0.0
  8. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations: discloses the 100-message scan ceiling, exact return shape, that only message content is matched (embed-only words are missed), the required permissions, and the failure mode (empty scan errors naming the missing permission). This is exactly the kind of context annotations cannot carry.

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?

Front-loads the core behavior and its main limitation, then routing, then return shape, then permissions. Dense but nearly every sentence adds a distinct constraint; only the return-value detail is arguably redundant given an output schema exists.

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

Completeness5/5

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

Given three simple parameters but non-obvious semantics (substring-only, 100-message window, permission-gated failures), the description covers everything an agent needs to call it and interpret results correctly, including the two most likely misuse paths.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it clarifies that matching applies to content only (not embeds), which is not stated in the keyword param, and that the limit is bounded by the 100-message scan window rather than being an independent page size.

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?

States a specific verb and scope ('Keyword search over a channel's recent messages using case-insensitive substring matching') and immediately constrains the window to the last 100 messages. An agent can distinguish this from discord_search_guild_messages and discord_read_messages from the first two sentences alone.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names two alternatives with the conditions that select them: discord_read_messages for unfiltered recent messages, and discord_search_guild_messages for full history in one channel or the whole server. When-not guidance is stated as a hard limit ('does not search full history').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools