Search messages
discord_
Read-only
- Toolset
- Messages
messages - Discord permissions
- View Channel and Read Message History
- Context cost
- 557 tokens, estimated2,228 bytes of definition, divided by 4
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_ to fetch recent messages without filtering. To search full history, in one channel or the whole server, use discord_.
Risk and annotations
Read-onlyreadOnlyHint | yes | Does not modify your server. |
|---|---|---|
DestructivedestructiveHint | n/a | Not declared: it only applies to tools that write. |
IdempotentidempotentHint | n/a | Not declared. |
Open worldopenWorldHint | yes | Interacts with an external system: Discord. |
Annotations are hints the server declares. Clients use them to decide when to ask you before a call.
Parameters
| Parameter | Type | Rules | Description |
|---|---|---|---|
| channel_ | string | pattern ^\d{17,20}$ | ID (snowflake) of the channel or thread to search. |
| keywordrequired | string | none | Case-insensitive substring to match within message content. |
| limitoptional | integer | 1 to 100default 100 | Max number of recent messages to scan (1–100). Default 100. |
Output
Declared by outputSchema: clients receive this shape as structuredContent.
| Field | Type | Description |
|---|---|---|
| matchesrequired | array of objects | |
| id (nested, level 1)required | string | |
| author (nested, level 1)required | string | |
| author_ | string | |
| webhook_ | string | |
| content (nested, level 1)required | string | |
| timestamp (nested, level 1)required | string | |
| embeds (nested, level 1) | array of objects | |
| title (nested, level 2) | string | |
| author (nested, level 2) | string | |
| description (nested, level 2) | string | |
| url (nested, level 2) | string | |
| fields (nested, level 2) | array of objects | |
| name (nested, level 3)required | string | |
| value (nested, level 3)required | string | |
| moreFields (nested, level 2) | number | Count of fields left out past the first 10. Absent when none were. |
| footer (nested, level 2) | string |
Related tools
Named in its description
-
Read messages, Read-only
discord_read_ messages -
Search guild messages, Read-only
discord_search_ guild_ messages
Also in Messages
-
Send message, Write
discord_send_ message -
Reply to message, Write
discord_reply_ message -
Edit message, Write
discord_edit_ message -
Add reaction, Write
discord_add_ reaction -
List channel threads, Read-only
discord_list_ channel_ threads -
Create thread, Write
discord_create_ thread -
Bulk delete messages, Destructive
discord_bulk_ delete_ messages -
Send embed, Write
discord_send_ embed -
Edit embed, Write
discord_edit_ embed -
Send multiple embeds, Write
discord_send_ multiple_ embeds -
Delete message, Destructive
discord_delete_ message -
Pin or unpin message, Write
discord_pin_ message -
Crosspost message, Write
discord_crosspost_ message -
Remove reactions, Destructive
discord_remove_ reactions -
Get reactions, Read-only
discord_get_ reactions -
Get message attachments, Read-only
discord_get_ message_ attachments -
Fetch pinned messages, Read-only
discord_fetch_ pinned_ messages -
Forward message, Write
discord_forward_ message
Raw definition (2,228 bytes)
{
"name": "discord_search_messages",
"description": "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.",
"inputSchema": {
"type": "object",
"properties": {
"channel_id": {
"type": "string",
"pattern": "^\\d{17,20}$",
"description": "ID (snowflake) of the channel or thread to search."
},
"keyword": {
"type": "string",
"description": "Case-insensitive substring to match within message content."
},
"limit": {
"default": 100,
"description": "Max number of recent messages to scan (1–100). Default 100.",
"type": "integer",
"minimum": 1,
"maximum": 100
}
},
"required": [
"channel_id",
"keyword"
],
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"properties": {
"matches": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"author": {
"type": "string"
},
"author_id": {
"type": "string"
},
"webhook_id": {
"type": "string"
},
"content": {
"type": "string"
},
"timestamp": {
"type": "string"
},
"embeds": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"author": {
"type": "string"
},
"description": {
"type": "string"
},
"url": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
],
"additionalProperties": false
}
},
"moreFields": {
"description": "Count of fields left out past the first 10. Absent when none were.",
"type": "number"
},
"footer": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"required": [
"id",
"author",
"author_id",
"content",
"timestamp"
],
"additionalProperties": false
}
}
},
"required": [
"matches"
],
"additionalProperties": false
},
"annotations": {
"title": "Search messages",
"readOnlyHint": true,
"openWorldHint": true
}
}