@coldiq/mcp 5.4.8 → 5.4.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"call-endpoint.d.ts","sourceRoot":"","sources":["../../src/tools/call-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,gBAAgB,kBAAkB,CAAA;AAE/C,eAAO,MAAM,uBAAuB,QAKgB,CAAA;AAEpD,eAAO,MAAM,kBAAkB;;;;;;;;;;;CAS9B,CAAA;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;GASvE"}
1
+ {"version":3,"file":"call-endpoint.d.ts","sourceRoot":"","sources":["../../src/tools/call-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB,kBAAkB,CAAA;AAE/C,eAAO,MAAM,uBAAuB,QAKgB,CAAA;AAEpD,eAAO,MAAM,kBAAkB;;;;;;;;;;;CAS9B,CAAA;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;GAavE"}
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { callApi } from '../client.js';
3
+ import { upstreamMessage } from '../upstream-message.js';
3
4
  export const callEndpointName = 'call_endpoint';
4
5
  export const callEndpointDescription = 'Call any ColdIQ marketplace endpoint directly with provider-native parameters — the generic invoke for ' +
5
6
  'providers/capabilities without a dedicated tool. Get the `api`, `path`, and required params from ' +
@@ -19,8 +20,12 @@ export const callEndpointSchema = {
19
20
  export async function callEndpointHandler(input) {
20
21
  const res = await callApi('POST', '/endpoints/use', { api: input.api, path: input.path, method: input.method, params: input.params });
21
22
  if (!res.ok) {
23
+ const message = upstreamMessage(res.data);
22
24
  return {
23
- content: [{ type: 'text', text: JSON.stringify({ error: 'Endpoint call failed', status: res.status, data: res.data }) }],
25
+ content: [{
26
+ type: 'text',
27
+ text: JSON.stringify({ error: 'Endpoint call failed', ...(message ? { message } : {}), status: res.status, data: res.data }),
28
+ }],
24
29
  isError: true,
25
30
  };
26
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"call-endpoint.js","sourceRoot":"","sources":["../../src/tools/call-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAClC,yGAAyG;IACzG,mGAAmG;IACnG,6FAA6F;IAC7F,0GAA0G;IAC1G,kDAAkD,CAAA;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2EAA2E,CAAC;IACrG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gFAAgF,CAAC;IAC3G,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;SACjE,QAAQ,CAAC,0FAA0F,CAAC;IACvG,MAAM,EAAE,CAAC;SACN,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,QAAQ,EAAE;SACV,QAAQ,CAAC,qHAAqH,CAAC;CACnI,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAA8B;IACtE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,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jF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-endpoint-details.d.ts","sourceRoot":"","sources":["../../src/tools/get-endpoint-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,sBAAsB,yBAAyB,CAAA;AAE5D,eAAO,MAAM,6BAA6B,QAGV,CAAA;AAEhC,eAAO,MAAM,wBAAwB;;;;;;;;;;CAKpC,CAAA;AAED,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;GAS7E"}
1
+ {"version":3,"file":"get-endpoint-details.d.ts","sourceRoot":"","sources":["../../src/tools/get-endpoint-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,sBAAsB,yBAAyB,CAAA;AAE5D,eAAO,MAAM,6BAA6B,QAGV,CAAA;AAEhC,eAAO,MAAM,wBAAwB;;;;;;;;;;CAKpC,CAAA;AAED,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;GAkB7E"}
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { callApi } from '../client.js';
3
+ import { upstreamMessage } from '../upstream-message.js';
3
4
  export const getEndpointDetailsName = 'get_endpoint_details';
4
5
  export const getEndpointDetailsDescription = 'Get the real request schema, parameters, a ready-to-run request example, and price for one ColdIQ endpoint ' +
5
6
  '(from search_endpoints). Read the example before calling — it shows the exact provider-native params ' +
@@ -13,8 +14,17 @@ export const getEndpointDetailsSchema = {
13
14
  export async function getEndpointDetailsHandler(input) {
14
15
  const res = await callApi('POST', '/endpoints/details', { api: input.api, path: input.path, method: input.method });
15
16
  if (!res.ok) {
17
+ const message = upstreamMessage(res.data);
16
18
  return {
17
- content: [{ type: 'text', text: JSON.stringify({ error: 'Endpoint not found or details unavailable', status: res.status, data: res.data }) }],
19
+ content: [{
20
+ type: 'text',
21
+ text: JSON.stringify({
22
+ error: 'Endpoint not found or details unavailable',
23
+ ...(message ? { message } : {}),
24
+ status: res.status,
25
+ data: res.data,
26
+ }),
27
+ }],
18
28
  isError: true,
19
29
  };
20
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-endpoint-details.js","sourceRoot":"","sources":["../../src/tools/get-endpoint-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAA;AAE5D,MAAM,CAAC,MAAM,6BAA6B,GACxC,6GAA6G;IAC7G,uGAAuG;IACvG,8BAA8B,CAAA;AAEhC,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oFAAoF,CAAC;IAC9G,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gFAAgF,CAAC;IAC3G,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;SACjE,QAAQ,CAAC,0FAA0F,CAAC;CACxG,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,KAA8B;IAC5E,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IACnH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IA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EAAE,oBAAoB,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IACnH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACzC,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,KAAK,EAAE,2CAA2C;wBAClD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC/B,MAAM,EAAE,GAAG,CAAC,MAAM;wBAClB,IAAI,EAAE,GAAG,CAAC,IAAI;qBACf,CAAC;iBACH,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAA;AACjF,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The message the API sent with a failure, when it has one of its own.
3
+ *
4
+ * A miss on the wrong namespace is answered with the namespace that DOES
5
+ * serve the path. That sentence is the difference between an agent correcting
6
+ * itself and an agent reporting a live feature as broken, so every tool that
7
+ * wraps a failure lifts it to the top level instead of leaving it nested in
8
+ * `data`, where a model reading the envelope can miss it.
9
+ */
10
+ export declare function upstreamMessage(data: unknown): string | undefined;
11
+ //# sourceMappingURL=upstream-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-message.d.ts","sourceRoot":"","sources":["../src/upstream-message.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIjE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The message the API sent with a failure, when it has one of its own.
3
+ *
4
+ * A miss on the wrong namespace is answered with the namespace that DOES
5
+ * serve the path. That sentence is the difference between an agent correcting
6
+ * itself and an agent reporting a live feature as broken, so every tool that
7
+ * wraps a failure lifts it to the top level instead of leaving it nested in
8
+ * `data`, where a model reading the envelope can miss it.
9
+ */
10
+ export function upstreamMessage(data) {
11
+ if (!data || typeof data !== 'object')
12
+ return undefined;
13
+ const value = data.error;
14
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
15
+ }
16
+ //# sourceMappingURL=upstream-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-message.js","sourceRoot":"","sources":["../src/upstream-message.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IACvD,MAAM,KAAK,GAAI,IAA4B,CAAC,KAAK,CAAA;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldiq/mcp",
3
- "version": "5.4.8",
3
+ "version": "5.4.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod'
2
2
  import { callApi } from '../client.js'
3
+ import { upstreamMessage } from '../upstream-message.js'
3
4
 
4
5
  export const callEndpointName = 'call_endpoint'
5
6
 
@@ -24,8 +25,12 @@ export const callEndpointSchema = {
24
25
  export async function callEndpointHandler(input: Record<string, unknown>) {
25
26
  const res = await callApi('POST', '/endpoints/use', { api: input.api, path: input.path, method: input.method, params: input.params })
26
27
  if (!res.ok) {
28
+ const message = upstreamMessage(res.data)
27
29
  return {
28
- content: [{ type: 'text' as const, text: JSON.stringify({ error: 'Endpoint call failed', status: res.status, data: res.data }) }],
30
+ content: [{
31
+ type: 'text' as const,
32
+ text: JSON.stringify({ error: 'Endpoint call failed', ...(message ? { message } : {}), status: res.status, data: res.data }),
33
+ }],
29
34
  isError: true,
30
35
  }
31
36
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod'
2
2
  import { callApi } from '../client.js'
3
+ import { upstreamMessage } from '../upstream-message.js'
3
4
 
4
5
  export const getEndpointDetailsName = 'get_endpoint_details'
5
6
 
@@ -18,8 +19,17 @@ export const getEndpointDetailsSchema = {
18
19
  export async function getEndpointDetailsHandler(input: Record<string, unknown>) {
19
20
  const res = await callApi('POST', '/endpoints/details', { api: input.api, path: input.path, method: input.method })
20
21
  if (!res.ok) {
22
+ const message = upstreamMessage(res.data)
21
23
  return {
22
- content: [{ type: 'text' as const, text: JSON.stringify({ error: 'Endpoint not found or details unavailable', status: res.status, data: res.data }) }],
24
+ content: [{
25
+ type: 'text' as const,
26
+ text: JSON.stringify({
27
+ error: 'Endpoint not found or details unavailable',
28
+ ...(message ? { message } : {}),
29
+ status: res.status,
30
+ data: res.data,
31
+ }),
32
+ }],
23
33
  isError: true,
24
34
  }
25
35
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The message the API sent with a failure, when it has one of its own.
3
+ *
4
+ * A miss on the wrong namespace is answered with the namespace that DOES
5
+ * serve the path. That sentence is the difference between an agent correcting
6
+ * itself and an agent reporting a live feature as broken, so every tool that
7
+ * wraps a failure lifts it to the top level instead of leaving it nested in
8
+ * `data`, where a model reading the envelope can miss it.
9
+ */
10
+ export function upstreamMessage(data: unknown): string | undefined {
11
+ if (!data || typeof data !== 'object') return undefined
12
+ const value = (data as { error?: unknown }).error
13
+ return typeof value === 'string' && value.length > 0 ? value : undefined
14
+ }
@@ -54,4 +54,18 @@ describe('call_endpoint handler', () => {
54
54
  api: 'exa', path: '/exa/agent/runs', method: 'POST', params: { query: 'Research ColdIQ' },
55
55
  })
56
56
  })
57
+
58
+ it('surfaces the namespace the API suggests instead of burying it in data', async () => {
59
+ // This is the tool the incident agent actually called: it reached
60
+ // /endpoints/use with api "coldiq" for a path served by "mailboxes".
61
+ const body = { error: 'Endpoint not found for api=coldiq path=/mailboxes/quotes method=POST. That path exists under api="mailboxes".', code: -32004 }
62
+ globalThis.fetch = vi.fn(async () => new Response(JSON.stringify(body), { status: 404 })) as typeof fetch
63
+
64
+ const result = await callEndpointHandler({ api: 'coldiq', path: '/mailboxes/quotes', method: 'POST' })
65
+ const parsed = JSON.parse(result.content[0].text)
66
+
67
+ expect(result.isError).toBe(true)
68
+ expect(parsed.error).toBe('Endpoint call failed')
69
+ expect(parsed.message).toContain('api="mailboxes"')
70
+ })
57
71
  })
@@ -35,6 +35,30 @@ describe('get_endpoint_details handler', () => {
35
35
  expect(parsed.error).toBe('Endpoint not found or details unavailable')
36
36
  })
37
37
 
38
+ it('surfaces the namespace the API suggests instead of burying it in data', async () => {
39
+ // The API answers a wrong-namespace miss with the namespace that DOES
40
+ // serve the path. Swallowing that sentence is what let an agent report a
41
+ // live ColdIQ Mailbox surface as broken.
42
+ const body = { error: 'Endpoint not found for api=coldiq path=/mailboxes/quotes method=POST. That path exists under api="mailboxes".' }
43
+ globalThis.fetch = vi.fn(async () => new Response(JSON.stringify(body), { status: 404 })) as typeof fetch
44
+
45
+ const result = await getEndpointDetailsHandler({ api: 'coldiq', path: '/mailboxes/quotes', method: 'POST' })
46
+ const parsed = JSON.parse(result.content[0].text)
47
+
48
+ expect(result.isError).toBe(true)
49
+ expect(parsed.error).toBe('Endpoint not found or details unavailable')
50
+ expect(parsed.message).toContain('api="mailboxes"')
51
+ })
52
+
53
+ it('omits message when the failure body carries no message of its own', async () => {
54
+ globalThis.fetch = vi.fn(async () => new Response(JSON.stringify({ detail: 'upstream hiccup' }), { status: 502 })) as typeof fetch
55
+ const result = await getEndpointDetailsHandler({ api: 'limadata', path: '/nope' })
56
+ const parsed = JSON.parse(result.content[0].text)
57
+
58
+ expect(parsed.message).toBeUndefined()
59
+ expect(parsed.data).toEqual({ detail: 'upstream hiccup' })
60
+ })
61
+
38
62
  it('forwards the HTTP method for a shared endpoint path', async () => {
39
63
  let capturedBody: unknown
40
64
  globalThis.fetch = vi.fn(async (_url: string | URL | Request, opts?: RequestInit) => {