MCPcopy
hub / github.com/TanStack/ai / discoveryDescription

Function discoveryDescription

testing/e2e/tests/lazy-tools-wire.spec.ts:41–60  ·  view source on GitHub ↗

* Find the discovery tool's wire `description` for this test's request only. * * The journal is shared across all parallel tests on the one aimock instance, * so entries are filtered by the test's `X-Test-Id` (the same header that * isolates fixture sequencing) before reading the catalog text.

(
  request: import('@playwright/test').APIRequestContext,
  aimockPort: number,
  testId: string,
)

Source from the content-addressed store, hash-verified

39 * isolates fixture sequencing) before reading the catalog text.
40 */
41async function discoveryDescription(
42 request: import('@playwright/test').APIRequestContext,
43 aimockPort: number,
44 testId: string,
45): Promise<string | undefined> {
46 const journalRes = await request.get(
47 `http://127.0.0.1:${aimockPort}/v1/_requests`,
48 )
49 const entries = (await journalRes.json()) as Array<JournalEntry>
50 for (const entry of entries) {
51 if (entry.headers?.['x-test-id'] !== testId) continue
52 const discovery = entry.body?.tools?.find(
53 (t) => t.function?.name === DISCOVERY_TOOL_NAME,
54 )
55 if (discovery?.function?.description) {
56 return discovery.function.description
57 }
58 }
59 return undefined
60}
61
62test.describe('lazy tools — discovery catalog wire format', () => {
63 // No journal reset here: the shared aimock journal is filtered per-test by

Callers 1

Calls 2

jsonMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected