Skip to main content
Glama
discord-mcp

discord-mcp

messages_search_recent

Read-onlyIdempotent

Find a recently sent message by keyword by scanning a Discord channel's recent messages and filtering them client-side, so you can locate content without manual iteration.

Instructions

Purpose: Substring-search recent messages in a channel.

When to use: - Locate a recently sent message by keyword without iterating manually.

When NOT to use: - Server-wide search → not supported by Discord REST. This tool only fans out the most recent N messages of ONE channel and filters client-side. For deep history, use external indexing.

Example: {channel_id:"111122223333444401", query:"deploy", limit:100}

Returns: {matches:[…], scanned_count, oldest_scanned_id?, newest_scanned_id?, channel_id, query}. Structured matches remain raw Discord data; the human-readable MCP content response fences matched message text. Resume older history with before: oldest_scanned_id.

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>",
      "query": "<query>"
    },
    "name": "messages_search_recent"
  }
}

Input Schema

NameRequiredDescriptionDefault
afterNoScan window: messages after this ID (newer); mutually exclusive with before
limitNoMax recent messages to scan (1-100, default 100). NOT a result cap.
queryYesSubstring to match (case-insensitive)
beforeNoScan window: messages before this ID (older); mutually exclusive with after
channel_idYesChannel to scan

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.26.0
    • changedInput schema / properties / after / description
      Previous value: -"Scan window: messages after this ID (newer)"New value: +"Scan window: messages after this ID (newer); mutually exclusive with before"
    • changedInput schema / properties / before / description
      Previous value: -"Scan window: messages before this ID (older)"New value: +"Scan window: messages before this ID (older); mutually exclusive with after"
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "$schema": "https://json-schema.org/draft/2020-12/schema",
      -    "additionalProperties": {},
      -    "properties": {
      -      "channel_id": {
      -        "description": "Discord channel ID (snowflake)",
      -        "pattern": "^\\d{17,20}$",
      -        "type": "string"
      -      },
      -      "matches": {
      -        "items": {
      -          "additionalProperties": false,
      -          "properties": {
      -            "author_id": {
      -              "description": "Discord user ID",
      -              "pattern": "^\\d{17,20}$",
      -              "type": "string"
      -            },
      -            "author_name": {
      -              "type": "string"
      -            },
      -            "content": {
      -              "type": "string"
      -            },
      -            "message_id": {
      -              "description": "Discord message ID",
      -              "pattern": "^\\d{17,20}$",
      -              "type": "string"
      -            },
      -            "timestamp": {
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "message_id",
      -            "author_id",
      -            "author_name",
      -            "content",
      -            "timestamp"
      -          ],
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "query": {
      -        "type": "string"
      -      },
      -      "scanned_count": {
      -        "maximum": 9007199254740991,
      -        "minimum": -9007199254740991,
      -        "type": "integer"
      -      }
      -    },
      -    "required": [
      -      "matches",
      -      "scanned_count",
      -      "channel_id",
      -      "query"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "category": {
      -        "enum": [
      -          "client",
      -          "server"
      -        ],
      -        "type": "string"
      -      },
      -      "code": {
      -        "type": "string"
      -      },
      -      "recovery_hint": {
      -        "type": "string"
      -      },
      -      "retriable": {
      -        "type": "boolean"
      -      }
      -    },
      -    "required": [
      -      "code",
      -      "retriable",
      -      "category",
      -      "recovery_hint"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "$schema": "https://json-schema.org/draft/2020-12/schema",
      +    "additionalProperties": {},
      +    "properties": {
      +      "channel_id": {
      +        "description": "Discord channel ID (snowflake)",
      +        "pattern": "^\\d{17,20}$",
      +        "type": "string"
      +      },
      +      "matches": {
      +        "items": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "author_id": {
      +              "description": "Discord user ID",
      +              "pattern": "^\\d{17,20}$",
      +              "type": "string"
      +            },
      +            "author_name": {
      +              "type": "string"
      +            },
      +            "content": {
      +              "type": "string"
      +            },
      +            "message_id": {
      +              "description": "Discord message ID",
      +              "pattern": "^\\d{17,20}$",
      +              "type": "string"
      +            },
      +            "timestamp": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "message_id",
      +            "author_id",
      +            "author_name",
      +            "content",
      +            "timestamp"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "newest_scanned_id": {
      +        "description": "Discord message ID",
      +        "pattern": "^\\d{17,20}$",
      +        "type": "string"
      +      },
      +      "oldest_scanned_id": {
      +        "description": "Discord message ID",
      +        "pattern": "^\\d{17,20}$",
      +        "type": "string"
      +      },
      +      "query": {
      +        "type": "string"
      +      },
      +      "scanned_count": {
      +        "maximum": 9007199254740991,
      +        "minimum": -9007199254740991,
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "matches",
      +      "scanned_count",
      +      "channel_id",
      +      "query"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "category": {
      +        "enum": [
      +          "client",
      +          "server"
      +        ],
      +        "type": "string"
      +      },
      +      "code": {
      +        "type": "string"
      +      },
      +      "recovery_hint": {
      +        "type": "string"
      +      },
      +      "retriable": {
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "code",
      +      "retriable",
      +      "category",
      +      "recovery_hint"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. First observedv0.22.0

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, and open-world, so the safety profile is covered structurally. The description adds genuine behavioral context: the tool fans out the most recent N messages of one channel and filters client-side, and 'limit' is a scan budget rather than a result cap. The 'Returns' sentence largely restates the output schema, but the client-side-filter caveat and the note that matches stay as raw Discord payloads are real additions.

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-loaded with Purpose, then When to use / When NOT to use, then an example, then returns; an agent can stop reading after the first two blocks. The 'Returns' sentence is partly redundant with the output schema and is the one section that does not fully earn its place, but nothing else is wasteful.

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?

For a 5-parameter search tool with an output schema, the definition covers purpose, exclusions, an invocation example, response shape, and the pagination-resume pattern. An agent has everything needed to call it correctly and to handle the case where it is the wrong tool.

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 description coverage is 100%, so the baseline is 3 and the schema already documents every parameter including the before/after mutual exclusivity. The description goes beyond that by showing a concrete invocation example and by explaining that 'before: oldest_scanned_id' from a prior response is the way to walk further back in history, which ties parameters to returned fields in a way the schema cannot.

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 resource ('Substring-search recent messages in a channel') and immediately bounds the scope to one channel's most recent N messages. It is clearly distinguishable from a server-wide search tool without needing to inspect the schema.

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?

Provides an explicit 'When to use' (locate a recently sent message by keyword without manual iteration) and a 'When NOT to use' that names the actual limitation (Discord REST has no server-wide search) and points to an alternative approach (external indexing). This is the full when/when-not/alternative triad.

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