Skip to content

feat(messaging): add filter param to get_inbox#387

Open
Naman-B-Parlecha wants to merge 8 commits into
stickerdaniel:mainfrom
Naman-B-Parlecha:feature/inbox-filter-param
Open

feat(messaging): add filter param to get_inbox#387
Naman-B-Parlecha wants to merge 8 commits into
stickerdaniel:mainfrom
Naman-B-Parlecha:feature/inbox-filter-param

Conversation

@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor

@Naman-B-Parlecha Naman-B-Parlecha commented Apr 22, 2026

Summary

  • Add a filter parameter to get_inbox supporting unread, jobs, connections, inmail, and starred categories
  • Clicks LinkedIn's inbox filter pill buttons using accessible get_by_role("button", name=...) selectors instead of DOM class names, following repo scraping rules
  • Defaults to "none" (all conversations) for backward compatibility

Changes

  • linkedin_mcp_server/tools/messaging.py: Replace unread_only: bool with filter: Literal["none", "unread", "jobs", "connections", "inmail", "starred"], update docstring to list options for calling agents
  • linkedin_mcp_server/scraping/extractor.py: Add _INBOX_FILTER_LABELS map translating param values to LinkedIn button text, click the matching pill after page load
  • tests/test_tools.py: Parametrized test covering all 5 filter values plus default "none" case

Synthetic prompt

Add a filter parameter to get_inbox that lets callers filter the messaging inbox by unread, jobs, connections, inmail, or starred. Use LinkedIn's pill button UI via get_by_role selectors. Update tool, extractor, and tests.

Generated with Claude Opus 4.6

Test plan

  • uv run pytest tests/test_tools.py::TestMessagingTools — 11 tests pass
  • uv run ruff check — no lint issues
  • Pre-commit hooks pass (ruff, ruff-format, ty)
  • Live-tested get_inbox(unread_only=true) against real LinkedIn session — returned only unread conversations
  • Live-test remaining filters (jobs, connections, inmail, starred) against real LinkedIn session

Add a `filter` parameter to `get_inbox` that supports filtering
conversations by unread, jobs, connections, inmail, or starred.
Clicks LinkedIn's inbox filter pill buttons using accessible
role-based selectors instead of DOM class names.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR adds inbox category filtering to the messaging inbox tool. The main changes are:

  • Adds an inbox_filter argument for unread, jobs, connections, InMail, and starred inbox views.
  • Maps filter values to LinkedIn inbox pill labels in the extractor.
  • Clicks the selected filter pill before scraping inbox content and thread references.
  • Surfaces filter activation failures through section_errors.
  • Adds tool-wrapper tests for default and explicit filter forwarding.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
linkedin_mcp_server/tools/messaging.py Adds the inbox_filter tool argument and forwards it to the extractor.
linkedin_mcp_server/scraping/extractor.py Applies the requested inbox filter pill before scraping conversations.
tests/test_tools.py Covers wrapper forwarding for default and explicit inbox filters.

Reviews (10): Last reviewed commit: "Merge branch 'main' into feature/inbox-f..." | Re-trigger Greptile

Comment thread linkedin_mcp_server/scraping/extractor.py Outdated
When the inbox filter button click fails, the result now includes a
section_errors entry so callers can detect that results may be unfiltered.
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

@stickerdaniel can u PTAL!!

@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

Hey @stickerdaniel bumping this up

@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

@stickerdaniel noticed there was a merge conflict have resolved it PTAL!
THANKS

Comment thread linkedin_mcp_server/scraping/extractor.py
@stickerdaniel
Copy link
Copy Markdown
Owner

Hey, thanks for the PR! A few things before this can go in:

docs/kubernetes-deployment.md seems to have slipped in from your backfill merge. It references finalroundai/infra and looks like your private deployment notes. Could you drop that file?

The filter labels are English only, which breaks on non-English LinkedIn sessions (e.g. on a German account "Unread" is "Ungelesen", the button lookup misses, and the caller silently gets back unfiltered results). The scraping rules in CLAUDE.md are pretty strict about locale-independence. Could you either widen _INBOX_FILTER_LABELS into a per-locale dict keyed off the page lang attribute, or keep it English-only and document the limitation on the docstring + a comment on the map?

Also filter shadows the Python builtin. Since you're already breaking the API by replacing unread_only, would you mind renaming to inbox_filter while you're in there?

@Naman-B-Parlecha Naman-B-Parlecha force-pushed the feature/inbox-filter-param branch from 9bb5c28 to e3b9425 Compare May 12, 2026 07:03
# Conflicts:
#	linkedin_mcp_server/scraping/extractor.py
…imit

- Rename get_inbox `filter` param to `inbox_filter` to stop shadowing the
  Python builtin
- Document that `_INBOX_FILTER_LABELS` is English-only; non-English
  sessions surface a `filter_failed` entry in `section_errors`
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

Hey @stickerdaniel, Thanks for spotting the .md file
Regarding the language blocker currently have added a comment for no-support for non-english based if this feature want expansion to other language we an add support down the line if thats fine?

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 12, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

Comment thread linkedin_mcp_server/scraping/extractor.py Outdated
Replace the 1s wall-clock pause after clicking an inbox filter pill
with a wait on the pill's `aria-pressed="true"` state. The fixed
delay could return unfiltered results on slow renders without
flipping `filter_failed`, defeating the safety net. Locator
intersection routes timeouts into the existing fail path.
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.

2 participants