@coldiq/mcp 0.1.11 → 0.1.13
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/package.json +5 -1
- package/src/client.ts +31 -1
- package/src/executor.ts +36 -14
- package/src/registry.ts +111 -29
- package/src/tools/enrich-company.ts +4 -4
- package/src/tools/enrich-person.ts +3 -3
- package/src/tools/fetch-page-content.ts +3 -3
- package/src/tools/find-email.ts +4 -4
- package/src/tools/find-emails.ts +69 -5
- package/src/tools/find-influencers.ts +3 -3
- package/src/tools/find-people.ts +5 -5
- package/src/tools/find-phone.ts +4 -4
- package/src/tools/find-signals.ts +5 -5
- package/src/tools/search-ads.ts +3 -3
- package/src/tools/search-companies.ts +3 -3
- package/src/tools/search-jobs.ts +4 -4
- package/src/tools/search-places.ts +3 -3
- package/src/tools/search-reddit.ts +3 -3
- package/src/tools/search-seo.ts +3 -3
- package/src/tools/search-web.ts +3 -3
- package/src/tools/verify-email.ts +3 -3
- package/tests/client.test.ts +32 -0
- package/tests/executor.test.ts +81 -0
- package/tests/live/companyenrich-async-probe.ts +31 -0
- package/tests/live/companyenrich-fix-validation.ts +125 -0
- package/tests/live/companyenrich-hybrid-probe.ts +54 -0
- package/tests/live/companyenrich-query-probe.ts +49 -0
- package/tests/live/companyenrich-ranges-probe.ts +49 -0
- package/tests/live/companyenrich-upstream-probe.ts +72 -0
- package/tests/live/wework-brazil-trace.ts +200 -0
- package/tests/registry-find-people.test.ts +111 -0
- package/tests/registry-polling.test.ts +61 -0
- package/tests/registry.test.ts +35 -18
- package/tests/tools/find-emails.test.ts +108 -0
- package/tests/tools/response-format.test.ts +45 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
|
2
|
+
import { initClient } from '../../src/client.js'
|
|
3
|
+
import { searchCompaniesHandler } from '../../src/tools/search-companies.js'
|
|
4
|
+
import { findEmailHandler } from '../../src/tools/find-email.js'
|
|
5
|
+
|
|
6
|
+
describe('tool response format', () => {
|
|
7
|
+
const originalFetch = globalThis.fetch
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
initClient('http://test-api.local', 'test-key')
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
globalThis.fetch = originalFetch
|
|
15
|
+
vi.restoreAllMocks()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('success response is compact JSON (no indentation)', async () => {
|
|
19
|
+
globalThis.fetch = vi.fn(async () =>
|
|
20
|
+
new Response(JSON.stringify({ companies: [{ name: 'Acme' }] }), { status: 200 }),
|
|
21
|
+
) as typeof fetch
|
|
22
|
+
|
|
23
|
+
const result = await searchCompaniesHandler({ keywords: ['SaaS'], limit: 5 })
|
|
24
|
+
const text = result.content[0].text
|
|
25
|
+
|
|
26
|
+
expect(result.isError).toBeFalsy()
|
|
27
|
+
// Compact JSON has no newlines
|
|
28
|
+
expect(text).not.toContain('\n')
|
|
29
|
+
// Must be valid JSON
|
|
30
|
+
expect(() => JSON.parse(text)).not.toThrow()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('error response is compact JSON (no indentation)', async () => {
|
|
34
|
+
globalThis.fetch = vi.fn(async () =>
|
|
35
|
+
new Response(JSON.stringify({ error: 'Bad request' }), { status: 400 }),
|
|
36
|
+
) as typeof fetch
|
|
37
|
+
|
|
38
|
+
const result = await findEmailHandler({ first_name: 'Michel', last_name: 'Lieben', domain: 'coldiq.com' })
|
|
39
|
+
const text = result.content[0].text
|
|
40
|
+
|
|
41
|
+
expect(result.isError).toBeTruthy()
|
|
42
|
+
expect(text).not.toContain('\n')
|
|
43
|
+
expect(() => JSON.parse(text)).not.toThrow()
|
|
44
|
+
})
|
|
45
|
+
})
|