jd-intel-mcp 0.8.0 → 0.8.1

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.
Files changed (3) hide show
  1. package/errors.js +4 -11
  2. package/package.json +2 -1
  3. package/tools.js +13 -17
package/errors.js CHANGED
@@ -1,16 +1,9 @@
1
1
  /**
2
2
  * Error code taxonomy for all MCP tools.
3
3
  *
4
- * Codes are short and stable. Messages are short and factual.
5
- * The tool description teaches the AI what each code means; errors
6
- * themselves do not need to be verbose.
4
+ * The canonical codes now live in the jd-intel library (src/errors.js), so the
5
+ * library (which throws AtsError with a .code) and the MCP layer share one
6
+ * source of truth. Re-exported here to keep the existing import path stable.
7
7
  */
8
8
 
9
- export const ERROR_CODES = {
10
- COMPANY_NOT_FOUND: 'company_not_found', // Slug not in registry and not detected
11
- ATS_UNREACHABLE: 'ats_unreachable', // Known ATS failed (500, timeout)
12
- PARTIAL_FAILURE: 'partial_failure', // Discovery mode; some adapters failed
13
- INVALID_ARGS: 'invalid_args', // Missing required, wrong type, bad pattern
14
- NO_RESULTS: 'no_results', // Query succeeded, filters returned nothing
15
- RATE_LIMITED: 'rate_limited', // Upstream returned 429
16
- };
9
+ export { ERROR_CODES } from 'jd-intel';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "jd-intel-mcp",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
+ "mcpName": "io.github.prPMDev/jd-intel-mcp",
4
5
  "description": "MCP server for jd-intel. Your AI assistant fetches and reads full job descriptions across seven ATS platforms, no copy-paste.",
5
6
  "type": "module",
6
7
  "main": "server.js",
package/tools.js CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import { z } from 'zod';
13
- import { fetchJobs, detectAts as libDetectAts, registry, ATS_NAMES } from 'jd-intel';
13
+ import { fetchJobs, detectAts as libDetectAts, registry, ATS_NAMES, AtsError } from 'jd-intel';
14
14
 
15
15
  const { search: searchRegistry, findAtsBySlug } = registry;
16
16
  // Tolerate an older jd-intel that predates getSource. The bundle always
@@ -104,23 +104,19 @@ export function registerTools(server, deps = {}) {
104
104
  });
105
105
  } catch (err) {
106
106
  const msg = err.message || 'Unknown error';
107
- // Map the library error to the advertised taxonomy. Order matters: a rate
108
- // limit surfaces as "...API error...: 429", so the 429 check must run
109
- // before the generic /API error/ check. This string-matches the adapters'
110
- // message wording (the contained trade-off vs typed errors in the library).
111
- if (config && /Workday API error/.test(msg)) {
112
- // Keep the Workday triple-repair hint even on a 429.
113
- return error(
114
- ERROR_CODES.ATS_UNREACHABLE,
115
- `Workday rejected ${config.tenant}/${config.env}/${config.site}: ${msg}. Verify the triple against the careers URL https://{tenant}.{env}.myworkdayjobs.com/{site}.`
116
- );
117
- }
118
- if (/:\s*429\b/.test(msg)) {
119
- return error(ERROR_CODES.RATE_LIMITED, msg);
120
- }
121
- if (/API error/.test(msg)) {
122
- return error(ERROR_CODES.ATS_UNREACHABLE, msg);
107
+ // AtsError carries a stable .code from the adapter (ats_unreachable /
108
+ // rate_limited), so we map by code, not by parsing the message.
109
+ if (err instanceof AtsError) {
110
+ if (config && err.code === ERROR_CODES.ATS_UNREACHABLE) {
111
+ // Keep the Workday triple-repair hint.
112
+ return error(
113
+ ERROR_CODES.ATS_UNREACHABLE,
114
+ `Workday rejected ${config.tenant}/${config.env}/${config.site}: ${msg}. Verify the triple against the careers URL https://{tenant}.{env}.myworkdayjobs.com/{site}.`
115
+ );
116
+ }
117
+ return error(err.code, msg);
123
118
  }
119
+ // Anything else is an arg-validation error from the library.
124
120
  return error(ERROR_CODES.INVALID_ARGS, msg);
125
121
  }
126
122
  }