linkedin-relay-mcp 3.11.0 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/linkedin-relay/SKILL.md +12 -5
- package/dist/cli.js +120 -29
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +124 -32
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
|
@@ -61,16 +61,23 @@ presenting it as a data problem.
|
|
|
61
61
|
|
|
62
62
|
### `jobs` — 1 job-search call per 100 results. Job search with every filter.
|
|
63
63
|
```
|
|
64
|
-
jobs keywords:"<terms>" [location:"<place>" | geoId:"<id>"] [distance:<miles>]
|
|
64
|
+
jobs keywords:"<terms>" | ["<terms>", "<terms>", …] [location:"<place>" | geoId:"<id>"] [distance:<miles>]
|
|
65
65
|
[posted:"24h|week|month|<N>h|<N>d"] [experience:[internship|entry|associate|mid-senior|director|executive]]
|
|
66
66
|
[type:[full-time|part-time|contract|temporary|volunteer|internship|other]]
|
|
67
67
|
[workplace:[on-site|remote|hybrid]] [easyApply] [under10] [verified] [inNetwork] [fairChance]
|
|
68
68
|
[company|industry|function|title|place:[ids]] [filter:["key=v1,v2"]] [sort:recent|relevant]
|
|
69
|
-
[limit:1-
|
|
69
|
+
[limit:1-1000 per keyword set] [start:N] [details] [description] [compact]
|
|
70
70
|
```
|
|
71
71
|
Each item: `id`, `title`, `company`, `location`, `workplace`, `listed` (YYYY-MM-DD), `easyApply`,
|
|
72
72
|
`promoted`, `salary` (when the card shows one), `insights`, `url`. `compact` gives one line per job.
|
|
73
73
|
|
|
74
|
+
- **Several keyword sets in one call.** Pass `keywords` as a list: each set is searched with the
|
|
75
|
+
same filters, and the results are merged by job id. A job found by several sets comes back once,
|
|
76
|
+
with `matched` naming them; the most-matched come first. Treat that order as a hint, not a
|
|
77
|
+
ranking: LinkedIn matches keywords loosely ("AI agent developer" returns plain frontend jobs),
|
|
78
|
+
so a generic job can match every set. Rank on title and company.
|
|
79
|
+
`meta.searches` has each set's total, count, state and `next`; `meta.duplicates` is how many
|
|
80
|
+
repeats were merged. One set failing leaves the others, with `state: "failed"` in its entry.
|
|
74
81
|
- **Rank on the rows, then read the finalists with `job`.** `details` reads every row in full, 100
|
|
75
82
|
per job read, to add the apply link, applicants and employment type.
|
|
76
83
|
- **Check `data.location`.** A typed location is resolved by LinkedIn, and the place it chose is
|
|
@@ -80,9 +87,9 @@ Each item: `id`, `title`, `company`, `location`, `workplace`, `listed` (YYYY-MM-
|
|
|
80
87
|
batch, and `meta.state` is `complete` only when the results ran out. LinkedIn serves at most 1000
|
|
81
88
|
per search; narrow the query rather than paging deep.
|
|
82
89
|
- Job hunting has its own budget: 150 job-search calls and 60 job reads a day, apart from the
|
|
83
|
-
people and company `search`. A search call returns 100 jobs, so ten keyword
|
|
84
|
-
hundred results each take about 30 calls.
|
|
85
|
-
|
|
90
|
+
people and company `search`. A search call returns 100 jobs, so ten keyword sets of a few
|
|
91
|
+
hundred results each take about 30 calls. Reposts and recruiter copies of one role carry
|
|
92
|
+
different ids, so they are not merged: judge those by company, title and description.
|
|
86
93
|
|
|
87
94
|
### `job` — 1 job read per 100 jobs. Jobs, in full.
|
|
88
95
|
```
|
package/dist/cli.js
CHANGED
|
@@ -3279,6 +3279,7 @@ function compactJob(j) {
|
|
|
3279
3279
|
if (j.promoted) parts.push("promoted");
|
|
3280
3280
|
parts.push(j.salary);
|
|
3281
3281
|
if (j.apply?.url !== void 0) parts.push(`apply: ${j.apply.url}`);
|
|
3282
|
+
if (j.matched !== void 0) parts.push(`matched: ${j.matched.join(" + ")}`);
|
|
3282
3283
|
return parts.filter((p) => p !== void 0 && p !== "").map((p) => p.replaceAll(" | ", " / ")).join(" | ");
|
|
3283
3284
|
}
|
|
3284
3285
|
function shape(rows, opts, line) {
|
|
@@ -3287,9 +3288,17 @@ function shape(rows, opts, line) {
|
|
|
3287
3288
|
return project(rows, opts.fields);
|
|
3288
3289
|
return rows;
|
|
3289
3290
|
}
|
|
3290
|
-
function
|
|
3291
|
+
function keywordSets(keywords) {
|
|
3292
|
+
const given = keywords === void 0 ? [] : Array.isArray(keywords) ? keywords : [keywords];
|
|
3293
|
+
const out = [];
|
|
3294
|
+
for (const k of given.map((g) => g.trim())) {
|
|
3295
|
+
if (k !== "" && !out.some((o) => o.toLowerCase() === k.toLowerCase())) out.push(k);
|
|
3296
|
+
}
|
|
3297
|
+
return out;
|
|
3298
|
+
}
|
|
3299
|
+
function queryOf(req, filters, keywords) {
|
|
3291
3300
|
return {
|
|
3292
|
-
...
|
|
3301
|
+
...keywords ? { keywords } : {},
|
|
3293
3302
|
...req.location ? { location: req.location } : {},
|
|
3294
3303
|
...req.geoId ? { geoId: req.geoId } : {},
|
|
3295
3304
|
filters
|
|
@@ -3310,7 +3319,9 @@ async function collect(get, query, first, want) {
|
|
|
3310
3319
|
for (const [k, n] of Object.entries(page.unknownTypes))
|
|
3311
3320
|
out.unknownTypes[k] = (out.unknownTypes[k] ?? 0) + n;
|
|
3312
3321
|
const fresh = page.jobs.filter((j) => !out.jobs.some((x) => x.id === j.id));
|
|
3313
|
-
|
|
3322
|
+
const room = want - out.jobs.length;
|
|
3323
|
+
out.jobs.push(...fresh.slice(0, room));
|
|
3324
|
+
if (fresh.length > room) break;
|
|
3314
3325
|
if (page.jobs.length === 0 || out.total !== void 0 && start + PAGE_SIZE2 >= out.total) {
|
|
3315
3326
|
out.exhausted = true;
|
|
3316
3327
|
break;
|
|
@@ -3342,14 +3353,87 @@ async function addDetails(get, rows, withDescription) {
|
|
|
3342
3353
|
const unread = rows.filter((r) => !read.jobs.has(r.id)).length;
|
|
3343
3354
|
return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
|
|
3344
3355
|
}
|
|
3356
|
+
function reportOf(keywords, found, first) {
|
|
3357
|
+
const report = {
|
|
3358
|
+
...keywords !== void 0 ? { keywords } : {},
|
|
3359
|
+
claimedCount: found.total,
|
|
3360
|
+
returnedCount: found.jobs.length,
|
|
3361
|
+
state: found.stoppedBy === void 0 && found.exhausted ? "complete" : "partial"
|
|
3362
|
+
};
|
|
3363
|
+
if (!found.exhausted) report.next = first + found.jobs.length;
|
|
3364
|
+
if (found.stoppedBy !== void 0) report.stoppedBy = found.stoppedBy;
|
|
3365
|
+
return report;
|
|
3366
|
+
}
|
|
3367
|
+
function mergeInto(out, byId, jobs, keywords) {
|
|
3368
|
+
for (const job of jobs) {
|
|
3369
|
+
const seen = byId.get(job.id);
|
|
3370
|
+
if (seen !== void 0) {
|
|
3371
|
+
out.duplicates++;
|
|
3372
|
+
if (keywords !== void 0) seen.matched?.push(keywords);
|
|
3373
|
+
continue;
|
|
3374
|
+
}
|
|
3375
|
+
const row = keywords !== void 0 ? { ...job, matched: [keywords] } : job;
|
|
3376
|
+
byId.set(job.id, row);
|
|
3377
|
+
out.rows.push(row);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
async function searchAll(get, sets, base, first, want) {
|
|
3381
|
+
const out = { rows: [], searches: [], duplicates: 0, unknownTypes: {} };
|
|
3382
|
+
const byId = /* @__PURE__ */ new Map();
|
|
3383
|
+
for (const keywords of sets) {
|
|
3384
|
+
const found = await collect(get, { ...base, ...keywords ? { keywords } : {} }, first, want);
|
|
3385
|
+
if ("ok" in found) {
|
|
3386
|
+
out.failure = out.failure ?? found;
|
|
3387
|
+
out.searches.push({
|
|
3388
|
+
...keywords !== void 0 ? { keywords } : {},
|
|
3389
|
+
returnedCount: 0,
|
|
3390
|
+
state: "failed",
|
|
3391
|
+
stoppedBy: found.code
|
|
3392
|
+
});
|
|
3393
|
+
continue;
|
|
3394
|
+
}
|
|
3395
|
+
out.searches.push(reportOf(keywords, found, first));
|
|
3396
|
+
out.resolved = out.resolved ?? found.resolved;
|
|
3397
|
+
for (const [k, n] of Object.entries(found.unknownTypes))
|
|
3398
|
+
out.unknownTypes[k] = (out.unknownTypes[k] ?? 0) + n;
|
|
3399
|
+
mergeInto(out, byId, found.jobs, sets.length > 1 ? keywords : void 0);
|
|
3400
|
+
}
|
|
3401
|
+
if (sets.length > 1) out.rows.sort((x, y) => (y.matched?.length ?? 0) - (x.matched?.length ?? 0));
|
|
3402
|
+
return out;
|
|
3403
|
+
}
|
|
3404
|
+
function metaOf(merged, single, first, unread, readStop) {
|
|
3405
|
+
const searched = merged.searches;
|
|
3406
|
+
const allComplete = searched.every((r) => r.state === "complete");
|
|
3407
|
+
const meta = {
|
|
3408
|
+
state: allComplete && unread === 0 && readStop === void 0 ? "complete" : "partial",
|
|
3409
|
+
operation: "jobs"
|
|
3410
|
+
};
|
|
3411
|
+
if (single) {
|
|
3412
|
+
const { keywords: _k, state: _s, ...report } = searched[0];
|
|
3413
|
+
Object.assign(meta, report, { start: first });
|
|
3414
|
+
if (readStop !== void 0) meta.stoppedBy = meta.stoppedBy ?? readStop;
|
|
3415
|
+
} else {
|
|
3416
|
+
Object.assign(meta, {
|
|
3417
|
+
returnedCount: merged.rows.length,
|
|
3418
|
+
duplicates: merged.duplicates,
|
|
3419
|
+
start: first,
|
|
3420
|
+
searches: searched,
|
|
3421
|
+
...readStop !== void 0 ? { stoppedBy: readStop } : {}
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3424
|
+
if (unread > 0) meta.unread = unread;
|
|
3425
|
+
if (Object.keys(merged.unknownTypes).length > 0) meta.unknownTypes = merged.unknownTypes;
|
|
3426
|
+
return meta;
|
|
3427
|
+
}
|
|
3345
3428
|
async function runJobs(req, opts = {}, fetch2) {
|
|
3346
|
-
const
|
|
3429
|
+
const sets = keywordSets(req.keywords);
|
|
3430
|
+
const hasQuery = sets.length > 0 || [req.location, req.geoId].some((v) => v !== void 0 && v !== "");
|
|
3347
3431
|
if (!hasQuery) {
|
|
3348
3432
|
return err(
|
|
3349
3433
|
"jobs",
|
|
3350
3434
|
"INVALID_INPUT",
|
|
3351
3435
|
"give keywords, a location, or both",
|
|
3352
|
-
'lnrelay jobs "<keywords>" [--location "<place>" | --geo <id>] [filters]'
|
|
3436
|
+
'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>] [filters]'
|
|
3353
3437
|
);
|
|
3354
3438
|
}
|
|
3355
3439
|
const selection2 = jobFilterSelection(req.filter ?? {});
|
|
@@ -3359,31 +3443,26 @@ async function runJobs(req, opts = {}, fetch2) {
|
|
|
3359
3443
|
if (typeof get !== "function") return get;
|
|
3360
3444
|
const first = Math.max(0, req.start ?? 0);
|
|
3361
3445
|
const want = Math.max(1, Math.min(req.limit, MAX_RESULTS - first));
|
|
3362
|
-
const
|
|
3363
|
-
const
|
|
3364
|
-
if (
|
|
3446
|
+
const base = queryOf(req, selection2.filters);
|
|
3447
|
+
const merged = await searchAll(get, sets.length > 0 ? sets : [void 0], base, first, want);
|
|
3448
|
+
if (merged.rows.length === 0 && merged.failure !== void 0) {
|
|
3449
|
+
const f = merged.failure;
|
|
3450
|
+
return err("jobs", f.code, f.message, f.hint);
|
|
3451
|
+
}
|
|
3365
3452
|
let unread = 0;
|
|
3453
|
+
let readStop;
|
|
3366
3454
|
if (req.details === true) {
|
|
3367
|
-
const added = await addDetails(get,
|
|
3368
|
-
found.stoppedBy = found.stoppedBy ?? added.stoppedBy;
|
|
3455
|
+
const added = await addDetails(get, merged.rows, req.description === true);
|
|
3369
3456
|
unread = added.unread;
|
|
3457
|
+
readStop = added.stoppedBy;
|
|
3370
3458
|
}
|
|
3371
|
-
const
|
|
3459
|
+
const single = sets.length <= 1;
|
|
3460
|
+
const meta = metaOf(merged, single, first, unread, readStop);
|
|
3372
3461
|
return ok("jobs", {
|
|
3373
|
-
query,
|
|
3374
|
-
...
|
|
3375
|
-
items: shape(
|
|
3376
|
-
meta
|
|
3377
|
-
state: stoppedBy === void 0 && exhausted && unread === 0 ? "complete" : "partial",
|
|
3378
|
-
operation: "jobs",
|
|
3379
|
-
claimedCount: found.total,
|
|
3380
|
-
returnedCount: jobs.length,
|
|
3381
|
-
start: first,
|
|
3382
|
-
next: exhausted ? void 0 : first + jobs.length,
|
|
3383
|
-
...stoppedBy !== void 0 ? { stoppedBy } : {},
|
|
3384
|
-
...unread > 0 ? { unread } : {},
|
|
3385
|
-
...Object.keys(unknownTypes).length > 0 ? { unknownTypes } : {}
|
|
3386
|
-
}
|
|
3462
|
+
query: { ...base, ...sets.length > 0 ? { keywords: single ? sets[0] : sets } : {} },
|
|
3463
|
+
...merged.resolved !== void 0 ? { location: merged.resolved } : {},
|
|
3464
|
+
items: shape(merged.rows, opts, compactJob),
|
|
3465
|
+
meta
|
|
3387
3466
|
});
|
|
3388
3467
|
}
|
|
3389
3468
|
async function runJob(input, opts = {}, fetch2) {
|
|
@@ -3429,11 +3508,24 @@ async function runJob(input, opts = {}, fetch2) {
|
|
|
3429
3508
|
});
|
|
3430
3509
|
}
|
|
3431
3510
|
async function runJobFilters(req, opts = {}, fetch2) {
|
|
3511
|
+
const sets = keywordSets(req.keywords);
|
|
3512
|
+
if (sets.length > 1) {
|
|
3513
|
+
return err(
|
|
3514
|
+
"job-filters",
|
|
3515
|
+
"INVALID_INPUT",
|
|
3516
|
+
"job-filters takes one keyword set: its counts belong to that one query",
|
|
3517
|
+
'lnrelay job-filters "<keywords>" [filters]'
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3432
3520
|
const selection2 = jobFilterSelection(req.filter ?? {});
|
|
3433
3521
|
if (!selection2.ok) return err("job-filters", selection2.code, selection2.message);
|
|
3434
3522
|
const get = fetch2 ?? liveFetch("job-filters", opts.quiet === true);
|
|
3435
3523
|
if (typeof get !== "function") return get;
|
|
3436
|
-
const url = jobFiltersUrl({
|
|
3524
|
+
const url = jobFiltersUrl({
|
|
3525
|
+
...queryOf(req, selection2.filters, sets[0]),
|
|
3526
|
+
start: 0,
|
|
3527
|
+
count: PAGE_SIZE2
|
|
3528
|
+
});
|
|
3437
3529
|
const res = await get(url, "jobSearch");
|
|
3438
3530
|
const parsed = res.ok ? parseJobFilters(res.json) : res;
|
|
3439
3531
|
if (!parsed.ok) return err("job-filters", parsed.code, parsed.message, parsed.hint);
|
|
@@ -4120,7 +4212,7 @@ var COMMANDS = [
|
|
|
4120
4212
|
name: "jobs",
|
|
4121
4213
|
cost: "1 job-search call per 100 jobs; --details adds 1 job read per 100 jobs",
|
|
4122
4214
|
summary: "Job search with every filter the jobs page has. Cards carry id, title, company, place, workplace, listed date, Easy Apply. Read finalists with `job`.",
|
|
4123
|
-
usage: 'lnrelay jobs "<keywords>" [--location "<place>" | --geo <id>]
|
|
4215
|
+
usage: 'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>]\n [--distance <miles>]\n [--posted 24h|week|month|<N>h|<N>d] [--experience internship,entry,associate,\n mid-senior,director,executive] [--type full-time,part-time,contract,temporary,\n volunteer,internship,other] [--workplace on-site,remote,hybrid] [--easy-apply]\n [--under-10] [--verified] [--in-network] [--fair-chance] [--company <ids>]\n [--industry <ids>] [--function <codes>] [--title <ids>] [--place <geo-ids>]\n [--filter key=v1,v2 ...] [--sort recent|relevant] [--limit N] [--start N]\n [--details [--description]] [--compact | --fields a,b,c]\n Ids for --company/--industry/--title/--place/--filter come from `job-filters`.\n The resolved place is in data.location: check it, "Vienna" may resolve narrow.',
|
|
4124
4216
|
audience: ["cli", "mcp"],
|
|
4125
4217
|
risk: "read",
|
|
4126
4218
|
implemented: true
|
|
@@ -6675,8 +6767,7 @@ function jobsRequest(args) {
|
|
|
6675
6767
|
const sort = str(args, "sort");
|
|
6676
6768
|
if (sort !== void 0) filter.sort = sort;
|
|
6677
6769
|
const req = { limit: num(args, "limit") ?? 25, filter };
|
|
6678
|
-
|
|
6679
|
-
if (keywords !== void 0) req.keywords = keywords;
|
|
6770
|
+
if (args.positionals.length > 0) req.keywords = [...args.positionals];
|
|
6680
6771
|
const location = str(args, "location");
|
|
6681
6772
|
if (location !== void 0) req.location = location;
|
|
6682
6773
|
const geo = str(args, "geo");
|