Skip to content

Add chatId to messages_fetch query filters - #251

Merged
mattt merged 1 commit into
mattt:mainfrom
sebpretzer:messages-fetch-chat-id
Sep 29, 2026
Merged

mattt merged 1 commit into
mattt:mainfrom
sebpretzer:messages-fetch-chat-id

Conversation

@sebpretzer

@sebpretzer sebpretzer commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

This is a follow up to #245. Now that messages_fetch returns the conversation each message belongs to (isPartOf, including its @id), it would be good to be able to query on that @id as chatId to isolate messages to that conversation.

This will also be relevant if we add a chats_fetch call that would return the correct chatId based on criteria, but I am considering that out of scope for this PR. I will potentially follow up with another PR for that, assuming this is a direction we want to go.

Let me know what you think @mattt !

@sebpretzer sebpretzer changed the title Add chatId to messages_fetch Add chatId to messages_fetch query filters Sep 27, 2026
isPartOf reports each message's conversation @id, but nothing accepted
it back. chatId maps to Madrid's chatID predicate and composes with the
other filters, so chatId plus participants returns those senders' messages
in that conversation. An unknown chatId matches nothing rather than
falling back to every chat.
@sebpretzer
sebpretzer force-pushed the messages-fetch-chat-id branch from cc7d40a to 94ae8ba Compare September 27, 2026 19:40
@sebpretzer
sebpretzer marked this pull request as ready for review September 27, 2026 19:48
@mattt
mattt requested a lite review from Copilot September 27, 2026 20:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Adds optional chatId filtering to messages_fetch, allowing messages to be scoped to a specific conversation.

Changes:

  • Adds chatId to the tool schema.
  • Validates the parameter and applies conversation ID filtering.
File Description
App/​Services/​Messages.swift Adds chat ID parsing, validation, and message filtering.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mattt
mattt merged commit 915d3bc into mattt:main Sep 29, 2026
1 check passed
@mattt

mattt commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Thanks, @sebpretzer! And yes, a chats_fetch tool would be a welcome follow-up. It would give clients a way to find the chatId in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants