feat(job): add get_saved_jobs tool#523
Open
alfonzeta wants to merge 2 commits into
Open
Conversation
List authenticated user's saved job postings from /my-items/saved-jobs/ with pagination and job_ids for get_job_details chaining. Closes stickerdaniel#522 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Greptile SummaryThis PR adds a saved-jobs tool for LinkedIn job workflows. The main changes are:
Confidence Score: 4/5This is close, but the saved-jobs pagination should be fixed before merging.
linkedin_mcp_server/scraping/extractor.py Important Files Changed
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
linkedin_mcp_server/scraping/extractor.py:3376-3380
**Use saved-jobs offset** The saved-jobs path reuses `_PAGE_SIZE = 25` from job search, but the PR's live check says two saved-job pages returned 20 IDs, so this list paginates in 10-item pages. With `max_pages=2`, the second request jumps to `?start=25`, skipping saved jobs at offsets 10 through 24 and returning an incomplete list for anyone with more than one page of saved jobs.
```suggestion
saved_jobs_page_size = 10
url = (
base_url
if page_num == 0
else f"{base_url}?start={page_num * saved_jobs_page_size}"
)
```
Reviews (1): Last reviewed commit: "style: ruff format saved jobs warning lo..." | Re-trigger Greptile |
Comment on lines
+3376
to
+3380
| url = ( | ||
| base_url | ||
| if page_num == 0 | ||
| else f"{base_url}?start={page_num * _PAGE_SIZE}" | ||
| ) |
Contributor
There was a problem hiding this comment.
Use saved-jobs offset The saved-jobs path reuses
_PAGE_SIZE = 25 from job search, but the PR's live check says two saved-job pages returned 20 IDs, so this list paginates in 10-item pages. With max_pages=2, the second request jumps to ?start=25, skipping saved jobs at offsets 10 through 24 and returning an incomplete list for anyone with more than one page of saved jobs.
Suggested change
| url = ( | |
| base_url | |
| if page_num == 0 | |
| else f"{base_url}?start={page_num * _PAGE_SIZE}" | |
| ) | |
| saved_jobs_page_size = 10 | |
| url = ( | |
| base_url | |
| if page_num == 0 | |
| else f"{base_url}?start={page_num * saved_jobs_page_size}" | |
| ) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: linkedin_mcp_server/scraping/extractor.py
Line: 3376-3380
Comment:
**Use saved-jobs offset** The saved-jobs path reuses `_PAGE_SIZE = 25` from job search, but the PR's live check says two saved-job pages returned 20 IDs, so this list paginates in 10-item pages. With `max_pages=2`, the second request jumps to `?start=25`, skipping saved jobs at offsets 10 through 24 and returning an incomplete list for anyone with more than one page of saved jobs.
```suggestion
saved_jobs_page_size = 10
url = (
base_url
if page_num == 0
else f"{base_url}?start={page_num * saved_jobs_page_size}"
)
```
How can I resolve this? If you propose a fix, please make it concise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_saved_jobsMCP tool to list job postings saved by the authenticated user at/my-items/saved-jobs/{url, sections: {saved_jobs}, job_ids, references?}compatible with existingget_job_detailsmax_pages(1–10, default 3) using?start=offsetsa[href*="/jobs/view/"]job ID parsingCloses #522
Synthetic prompt
Test plan
uv run pytest tests/test_scraping.py::TestGetSavedJobsuv run pytest tests/test_tools.py::TestJobTools::test_get_saved_jobsget_saved_jobs(max_pages=2)returned 20 job IDs across 2 pages)