Skip to main content
Glama
jonmmease
by jonmmease

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations provided, the description carries full burden and excels by detailing graceful failure handling (partial failures, fallbacks, error returns), search mode behaviors, and response structure. It provides rich behavioral context beyond basic functionality.

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?

Well-structured with clear sections (overview, behavioral notes, parameters, returns) but somewhat lengthy. Most sentences earn their place by providing essential technical details, though some parameter explanations could be more concise.

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 the tool's complexity (10 parameters, sophisticated search logic, graceful failure handling) and the presence of an output schema, the description is remarkably complete. It covers purpose, behavior, parameters, returns, and failure modes thoroughly.

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

Parameters5/5

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

With 0% schema description coverage for 10 parameters, the description fully compensates by explaining each parameter's purpose, format constraints (ISO8601, exact match after normalization), default values, and allowed values for search_mode. It adds substantial meaning beyond the bare schema.

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?

The description clearly states the tool searches messages using hybrid keyword + semantic search, specifying the technical approach (FTS5 + OpenAI embeddings + RRF). It distinguishes from siblings like get_conversation_messages and get_recent_messages by emphasizing search capabilities rather than direct retrieval.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (for searching messages with flexible filtering and search modes) but doesn't explicitly mention when not to use it or name specific alternatives among siblings. It implies usage for search vs. direct retrieval tools.

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

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