Skip to main content
Glama

search_messages

Find iMessage conversations by searching with keywords or semantic meaning, filtering by sender, date, or chat type for precise results.

Instructions

Search messages using hybrid keyword + semantic search.

Combines FTS5 full-text search with OpenAI embedding-based semantic search, merged using Reciprocal Rank Fusion (RRF) for optimal relevance.

This function is designed to handle partial failures gracefully:

  • If sync fails, search uses existing index

  • If semantic search fails, falls back to keyword search

  • If keyword search fails, returns empty results rather than crashing

  • Returns error information in response for visibility

Args: query: Search query text sender: Filter by sender phone/email (exact match after normalization) chat_id: Filter by specific conversation ID participants: Filter by chat participants (for group chats) after_date: Only messages after this date (ISO8601 format) before_date: Only messages before this date (ISO8601 format) service: Filter by "iMessage" or "SMS" search_mode: "hybrid" (default), "keyword" (FTS5 only), or "semantic" (vector only) limit: Results per page (default 100) offset: Pagination offset (default 0)

Returns: Dictionary with messages, pagination, and index_status including: - messages: List of matching messages with relevance scores - search_mode: The search mode that was used - fts5_matches: Number of keyword matches found - semantic_matches: Number of semantic matches found - pagination: Pagination metadata (total, limit, offset, has_more, next_offset) - index_status: Current state of the search index - errors: List of error messages encountered (if any) - warning: Warning message if partial results (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
senderNo
chat_idNo
participantsNo
after_dateNo
before_dateNo
serviceNo
search_modeNohybrid
limitNo
offsetNo

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/jonmmease/jons-mcp-imessage'

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