MCPcopy Create free account
hub / github.com/TanStack/ai / createToolFixtureRecord

Function createToolFixtureRecord

packages/ai-devtools/src/store/hook-registry.ts:467–490  ·  view source on GitHub ↗
(
  draft: ToolFixtureRecordDraft,
)

Source from the content-addressed store, hash-verified

465}
466
467export function createToolFixtureRecord(
468 draft: ToolFixtureRecordDraft,
469): ToolFixtureRecord {
470 const createdAt = draft.createdAt ?? Date.now()
471 const fixtureScope = draft.hookId ?? draft.threadId ?? 'global'
472 const fixtureKey = draft.toolCallId ?? createdAt
473
474 return {
475 id: draft.id ?? `fixture:${fixtureScope}:${draft.toolName}:${fixtureKey}`,
476 createdAt,
477 ...(draft.name ? { name: draft.name } : {}),
478 ...(draft.hookId ? { hookId: draft.hookId } : {}),
479 ...(draft.threadId ? { threadId: draft.threadId } : {}),
480 ...(draft.runId ? { runId: draft.runId } : {}),
481 toolName: draft.toolName,
482 input: draft.input,
483 output: draft.output ?? null,
484 ...(draft.execute !== undefined ? { execute: draft.execute } : {}),
485 ...(draft.message ? { message: draft.message } : {}),
486 ...(draft.toolCallId ? { toolCallId: draft.toolCallId } : {}),
487 ...(draft.messageId ? { messageId: draft.messageId } : {}),
488 ...(draft.errorText ? { errorText: draft.errorText } : {}),
489 }
490}
491
492function createTimelineEvent(
493 eventType: string,

Callers 2

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected