Skip to content

[FEATURE] Add get_pending_invitations tool for network invitations #446

@ghul0

Description

@ghul0

Feature Description

Add a new MCP tool get_pending_invitations that lists pending LinkedIn network invitations (received or sent), mirroring the page at https://www.linkedin.com/mynetwork/invitation-manager/.

Initial scope is read-only. Accept / ignore / withdraw actions are intentionally out of scope for the first iteration to keep the PR focused; they can land in a follow-up if this one is accepted.

Use Case

The current toolset covers messaging (get_inbox, get_conversation) but exposes no surface for pending connection invitations, which is a primary inbound channel on LinkedIn:

  • Recruiters frequently use "Invite + note" instead of InMail. Those messages live in /mynetwork/invitation-manager/ and never appear in get_inbox until the invitation is accepted, so an AI agent assisting with inbound triage cannot see them today.
  • Users need a non-destructive way to triage incoming invitations before deciding whether to accept (which would then make the conversation visible to other tools in this server).
  • Symmetric sent listing is useful for reviewing outstanding outbound invitations a user has issued.

Suggested Approach

Follow the existing get_inbox pattern very closely:

  • New file linkedin_mcp_server/tools/network.py exposing register_network_tools(mcp, *, tool_timeout) and the tool function get_pending_invitations(ctx, limit, kind, extractor).
  • New extractor method LinkedInExtractor.get_pending_invitations(limit, kind) in scraping/extractor.py. Navigation -> detect_rate_limit -> _wait_for_main_text -> handle_modal_close -> _scroll_main_scrollable_region -> _extract_root_content(["main"]) -> strip_linkedin_noise -> build_references -> _single_section_result, identical to get_inbox.
  • Register the new module from server.py::create_mcp_server().
  • Parameter shape: limit: int (1-100, default 20), kind: Literal["received", "sent"] = "received". URL: /mynetwork/invitation-manager/{kind}/.
  • Return format: standard {url, sections: {invitations: raw_text}, references?: {invitations: [...]}}. No new section dict in fields.py needed — this is a one-page tool, not a sectioned scraper.
  • Tests: TestNetworkTools class in tests/test_tools.py mirroring TestMessagingTools::test_get_inbox_success; add get_pending_invitations to _make_mock_extractor.
  • Docs: README tool table, docs/docker-hub.md features list, manifest.json tools array.

I'm happy to open the PR myself; filing this issue first per CONTRIBUTING.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions