get_schema
Retrieve schema and structure information for span recordings, including available fields, example payloads, and filter options for common instrumentation types like HTTP, database queries, and gRPC.
Instructions
Get schema and structure information for span recordings on Tusk Drift.
Use this tool to:
Understand what fields are available for a specific instrumentation type
See example payloads for HTTP requests, database queries, etc.
Learn what to filter on before querying spans
Common package names:
http: Incoming HTTP requests (has statusCode, method, url, headers)
fetch: Outgoing HTTP calls
pg: PostgreSQL queries (has db.statement, db.name)
grpc: gRPC calls
express: Express.js middleware spans
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| observableServiceId | No | Service ID to query (required if multiple services available) | |
| packageName | No | Package name (e.g., 'http', 'pg', 'fetch') | |
| instrumentationName | No | Instrumentation name | |
| name | No | Span name to filter by | |
| showExample | No | Include an example span | |
| maxPayloadLength | No | Truncate example payload strings |
Implementation Reference
- src/tools/getSchema.ts:53-94 (handler)Handler function for the get_schema tool. Parses input via parseGetSchemaInput, calls client.getSchema(), and formats the result (description, commonJsonbFields, inputSchema, outputSchema, exampleSpanRecording) into a text response.
export async function handleGetSchema( client: TuskDriftApiClient, args: Record<string, unknown> ): Promise<{ content: Array<{ type: "text"; text: string }> }> { const input = parseGetSchemaInput(args); const result = await client.getSchema(input); const sections: string[] = []; if (result.description) { sections.push(`## Description\n${result.description}`); } if (result.commonJsonbFields) { sections.push(`## Common Queryable Fields **inputValue fields:** ${result.commonJsonbFields.inputValue.join(", ") || "(none)"} **outputValue fields:** ${result.commonJsonbFields.outputValue.join(", ") || "(none)"}`); } if (result.inputSchema) { sections.push(`## Input Schema\n\`\`\`json\n${JSON.stringify(result.inputSchema, null, 2)}\n\`\`\``); } if (result.outputSchema) { sections.push(`## Output Schema\n\`\`\`json\n${JSON.stringify(result.outputSchema, null, 2)}\n\`\`\``); } if (result.exampleSpanRecording) { sections.push(`## Example Span\n\`\`\`json\n${JSON.stringify(result.exampleSpanRecording, null, 2)}\n\`\`\``); } return { content: [ { type: "text", text: sections.join("\n\n") || "No schema information available.", }, ], }; } - src/types.ts:231-238 (schema)Zod schema (getSchemaInputSchema) defining input validation for get_schema: observableServiceId, packageName, instrumentationName, name, showExample (default true), maxPayloadLength (default 500).
export const getSchemaInputSchema = z.object({ observableServiceId: z.string().optional().describe("Service ID to query (required if multiple services available)"), packageName: z.string().optional().describe("Package name (e.g., 'http', 'pg', 'fetch')"), instrumentationName: z.string().optional().describe("Instrumentation name"), name: z.string().optional().describe("Span name to filter by"), showExample: z.boolean().default(true).describe("Include an example span"), maxPayloadLength: z.number().min(0).default(500).describe("Truncate example payload strings"), }); - src/types.ts:365-375 (schema)parseGetSchemaInput function that validates args against getSchemaInputSchema and creates a SharedGetSchemaRequest protobuf message.
export function parseGetSchemaInput(args: Record<string, unknown>): GetSchemaInput { const input: GetSchemaArgs = getSchemaInputSchema.parse(args); return SharedGetSchemaRequest.create({ observableServiceId: input.observableServiceId ?? "", packageName: input.packageName, instrumentationName: input.instrumentationName, name: input.name, showExample: input.showExample, maxPayloadLength: input.maxPayloadLength, }); } - src/types.ts:179-188 (schema)SchemaResult interface defining the response shape: inputSchema, outputSchema, exampleSpanRecording, commonJsonbFields (inputValue/outputValue string arrays), and description.
export interface SchemaResult { inputSchema?: unknown; outputSchema?: unknown; exampleSpanRecording?: Partial<SpanRecording>; commonJsonbFields: { inputValue: string[]; outputValue: string[]; }; description?: string; } - src/tools/index.ts:24-31 (registration)Registration of handleGetSchema in the toolHandlers map under the key 'get_schema'.
export const toolHandlers: Record<string, ToolHandler> = { query_spans: handleQuerySpans, get_schema: handleGetSchema, list_distinct_values: handleListDistinctValues, aggregate_spans: handleAggregateSpans, get_trace: handleGetTrace, get_spans_by_ids: handleGetSpansByIds, };