import { AggregateSpansRequest, GetSchemaRequest, GetSpansByIdsRequest, GetTraceSpansRequest, ListDistinctValuesRequest, QuerySpansRequest } from "@use-tusk/drift-schemas/query/span_query"; import { z } from "zod"; //#region src/types.d.ts interface TuskDriftConfig { /** Base URL for the Tusk Drift API (e.g., https://api.usetusk.ai) */ apiBaseUrl: string; /** API key or JWT token for authentication */ apiToken: string; /** Optional default observable service ID (can be overridden per request) */ observableServiceId?: string; } interface SpanRecording { id: string; spanId: string; traceId: string; parentSpanId?: string; name: string; kind: number; status: { code: number; message?: string; }; timestamp: string; duration: number; isRootSpan: boolean; packageName: string; instrumentationName: string; submoduleName?: string; environment?: string; inputValue?: unknown; outputValue?: unknown; inputSchema?: unknown; outputSchema?: unknown; metadata?: unknown; } interface TraceSpan extends SpanRecording { children?: TraceSpan[]; } interface SchemaResult { inputSchema?: unknown; outputSchema?: unknown; exampleSpanRecording?: Partial; commonJsonbFields: { inputValue: string[]; outputValue: string[]; }; description?: string; } interface DistinctValue { value: unknown; count: number; } interface AggregationRow { groupValues: Record; timeBucket?: string; count: number; errorCount?: number; errorRate?: number; avgDuration?: number; minDuration?: number; maxDuration?: number; p50Duration?: number; p95Duration?: number; p99Duration?: number; } type QuerySpansInput = QuerySpansRequest; type GetSchemaInput = GetSchemaRequest; type ListDistinctValuesInput = ListDistinctValuesRequest; type AggregateSpansInput = AggregateSpansRequest; type GetTraceInput = GetTraceSpansRequest; type GetSpansByIdsInput = GetSpansByIdsRequest; //#endregion //#region src/provider.d.ts /** * Result types for the data provider methods. * Normalized to work with both API responses and direct service calls. */ interface QuerySpansResult { spans: SpanRecording[]; total: number; hasMore: boolean; } interface ListDistinctValuesResult { values: DistinctValue[]; field: string; } interface AggregateSpansResult { results: AggregationRow[]; } interface GetTraceResult { traceTree: TraceSpan | null; spanCount: number; } interface GetSpansByIdsResult { spans: SpanRecording[]; } /** * Data provider interface for Tusk Drift queries. * This abstraction allows the MCP server to work with different backends: * - API client (for standalone/local usage via HTTP) * - Direct service (for backend integration) */ interface DriftDataProvider { /** * Query span recordings with filters. */ querySpans(input: QuerySpansInput): Promise; /** * Get schema information for a specific instrumentation. */ getSchema(input: GetSchemaInput): Promise; /** * List distinct values for a field. */ listDistinctValues(input: ListDistinctValuesInput): Promise; /** * Aggregate spans with grouping and metrics. */ aggregateSpans(input: AggregateSpansInput): Promise; /** * Get all spans in a trace as a tree. */ getTrace(input: GetTraceInput): Promise; /** * Get span recordings by IDs. */ getSpansByIds(input: GetSpansByIdsInput): Promise; } /** * Optional access control interface. * Implement this if you need to check permissions before executing queries. */ interface DriftAccessControl { /** * Check if the current user/client can access the given observable service. * @returns true if access is allowed, false otherwise */ canAccessService(observableServiceId: string): Promise; } /** * Configuration for creating an MCP server. */ interface CreateMcpServerOptions { /** * The data provider for executing queries. */ provider: DriftDataProvider; /** * Optional access control for checking permissions. */ accessControl?: DriftAccessControl; /** * Optional server instructions to include. */ instructions?: string; /** * Server name (default: "tusk-drift") */ name?: string; /** * Server version (default: "1.0.0") */ version?: string; } //#endregion export { SchemaResult as _, GetSpansByIdsResult as a, TuskDriftConfig as b, QuerySpansResult as c, DistinctValue as d, GetSchemaInput as f, QuerySpansInput as g, ListDistinctValuesInput as h, DriftDataProvider as i, AggregateSpansInput as l, GetTraceInput as m, CreateMcpServerOptions as n, GetTraceResult as o, GetSpansByIdsInput as p, DriftAccessControl as r, ListDistinctValuesResult as s, AggregateSpansResult as t, AggregationRow as u, SpanRecording as v, TraceSpan as y }; //# sourceMappingURL=provider-QQ-bqpKg.d.mts.map