get-table-sample-data-by-name
Get a preview of table data by specifying the fully qualified name. Returns sample rows for inspection.
Instructions
Get sample data rows for a table by fully qualified name
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fqn | Yes | Fully qualified table name (e.g. 'service.database.schema.tableName') |
Implementation Reference
- src/tools/sample-data.ts:20-23 (handler)The handler function that executes the 'get-table-sample-data-by-name' tool: looks up the table by its fully qualified name (FQN) via OpenMetadata's /tables/name endpoint to get its UUID, then fetches sample data from /tables/{id}/sampleData.
export async function getTableSampleDataByName(params: z.infer<typeof getTableSampleDataByNameSchema>) { const entity = await omClient.get<{ id: string }>(`/tables/name/${encodeURIComponent(params.fqn)}`, { fields: "id" }); return omClient.get(`/tables/${entity.id}/sampleData`); } - src/tools/sample-data.ts:16-18 (schema)Zod schema defining the single required input parameter 'fqn' (fully qualified table name, e.g. 'service.database.schema.tableName').
export const getTableSampleDataByNameSchema = z.object({ fqn: z.string().describe("Fully qualified table name (e.g. 'service.database.schema.tableName')"), }); - src/index.ts:424-425 (registration)Registration of the tool via the `tool()` call, mapping the name 'get-table-sample-data-by-name' to its schema and handler function, wrapped with error handling.
tool("get-table-sample-data", "Get sample data rows for a table by UUID (use this instead of querying BigQuery directly)", getTableSampleDataSchema.shape, wrapToolHandler(getTableSampleData)); tool("get-table-sample-data-by-name", "Get sample data rows for a table by fully qualified name", getTableSampleDataByNameSchema.shape, wrapToolHandler(getTableSampleDataByName)); - src/index.ts:126-133 (registration)Import of the schema and handler from src/tools/sample-data.js into the main entry point.
import { getTableSampleDataSchema, getTableSampleData, getTableSampleDataByNameSchema, getTableSampleDataByName, getTopicSampleDataSchema, getTopicSampleData, getTopicSampleDataByNameSchema, getTopicSampleDataByName, getContainerSampleDataSchema, getContainerSampleData, getContainerSampleDataByNameSchema, getContainerSampleDataByName, } from "./tools/sample-data.js"; - src/prompts.ts:196-196 (helper)Reference to the tool in the 'data-contract-bootstrap' prompt, instructing the LLM to call 'get-table-sample-data-by-name' to pull sample data for schema inference.
? "4. Pull sample data: `get-table-sample-data-by-name` with fqn=" + JSON.stringify(tableFqn) + ", limit=100. Use it to *infer* schema rules (do not promise them as truth):\n - column has zero nulls in sample → suggest `required: true` (NOT NULL).\n - numeric column min/max range → suggest `range` quality rule with the observed bounds + 20% padding.\n - string column distinct values < 20 → suggest `enum` rule with the distinct values.\n - all rows match a regex (email/url/uuid/iso-date) → suggest `pattern` rule.\n Mark each inferred rule as **inferred** in the output so the reviewer can tighten them."