@burdenoff/mcp-libs 2026.1107.3 → 2026.1107.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/semanticfed/index.cjs +77 -0
- package/dist/modules/semanticfed/index.cjs.map +1 -1
- package/dist/modules/semanticfed/index.js +77 -0
- package/dist/modules/semanticfed/index.js.map +1 -1
- package/dist/modules/semanticfed/operations.d.ts +2 -0
- package/dist/modules/semanticfed/tools/sql.d.ts +3 -0
- package/package.json +50 -37
|
@@ -414,6 +414,26 @@ var HEALTH = `
|
|
|
414
414
|
semHealth
|
|
415
415
|
}
|
|
416
416
|
`;
|
|
417
|
+
var EXECUTE_SQL = `
|
|
418
|
+
mutation SemExecuteSql($input: SemExecuteSqlInput!) {
|
|
419
|
+
semExecuteSql(input: $input) {
|
|
420
|
+
modelId
|
|
421
|
+
columns { name entity field aggregation dataType masked mask }
|
|
422
|
+
rows rowCount truncated durationMs sourcesTouched planSummary
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
`;
|
|
426
|
+
var SQL_CATALOG = `
|
|
427
|
+
query SemSqlCatalog($modelId: ID) {
|
|
428
|
+
semSqlCatalog(modelId: $modelId) {
|
|
429
|
+
modelId modelName
|
|
430
|
+
tables {
|
|
431
|
+
name kind primaryKey description
|
|
432
|
+
columns { name kind dataType isPrimary aggregation description }
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
`;
|
|
417
437
|
var ConnectorKindEnum = zod.z.enum([
|
|
418
438
|
"BIGQUERY",
|
|
419
439
|
"CLICKHOUSE",
|
|
@@ -1608,6 +1628,60 @@ function registerHealthTools(server, ctx, track) {
|
|
|
1608
1628
|
}
|
|
1609
1629
|
);
|
|
1610
1630
|
}
|
|
1631
|
+
var READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true };
|
|
1632
|
+
function registerSqlTools(server, ctx, track) {
|
|
1633
|
+
server.registerTool(
|
|
1634
|
+
track(mcpToolName(ctx.productName, "sql_execute")),
|
|
1635
|
+
{
|
|
1636
|
+
title: "Execute SQL",
|
|
1637
|
+
description: "Run ONE read-only SQL SELECT against a semantic model and get the governed rows back synchronously. Tables are the model entities and columns their dimensions and metrics (call sql_catalog first to see them). Supported: SELECT [DISTINCT], *, SUM/AVG/MIN/MAX/COUNT/COUNT(DISTINCT), [INNER|LEFT] JOIN ... ON a = b, WHERE/HAVING with comparisons, IN, LIKE/ILIKE, BETWEEN, IS NULL, AND/OR/NOT, GROUP BY, ORDER BY, LIMIT, OFFSET. Writes and multiple statements are rejected. Your row and column access policies apply: filtered rows are absent and masked columns come back masked (see columns[].masked). truncated=true means more rows matched than maxRows. Each call counts against the monthly query quota.",
|
|
1638
|
+
inputSchema: {
|
|
1639
|
+
sql: zod.z.string().min(1).describe("One SELECT statement"),
|
|
1640
|
+
modelId: zod.z.string().optional().describe("Semantic model ID; optional when the workspace has exactly one model"),
|
|
1641
|
+
maxRows: zod.z.number().int().min(1).max(1e4).optional().describe("Maximum rows returned (default 1000, max 10000)"),
|
|
1642
|
+
timeoutMs: zod.z.number().int().min(1e3).max(6e4).optional().describe("Execution time limit in milliseconds (default 30000)")
|
|
1643
|
+
},
|
|
1644
|
+
annotations: { title: "Execute SQL", ...READ_ONLY, openWorldHint: true }
|
|
1645
|
+
},
|
|
1646
|
+
async ({ sql, modelId, maxRows, timeoutMs }) => {
|
|
1647
|
+
try {
|
|
1648
|
+
const input = { sql };
|
|
1649
|
+
if (modelId) input.modelId = modelId;
|
|
1650
|
+
if (maxRows !== void 0) input.maxRows = maxRows;
|
|
1651
|
+
if (timeoutMs !== void 0) input.timeoutMs = timeoutMs;
|
|
1652
|
+
const data = await ctx.gql.workspace.request(EXECUTE_SQL, { input });
|
|
1653
|
+
return jsonResult(data.semExecuteSql);
|
|
1654
|
+
} catch (error) {
|
|
1655
|
+
ctx.logger.error("semanticfed sql_execute failed", { error: String(error) });
|
|
1656
|
+
return errorResult(
|
|
1657
|
+
`Failed to execute SQL: ${error instanceof Error ? error.message : String(error)}`
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
);
|
|
1662
|
+
server.registerTool(
|
|
1663
|
+
track(mcpToolName(ctx.productName, "sql_catalog")),
|
|
1664
|
+
{
|
|
1665
|
+
title: "SQL Catalog",
|
|
1666
|
+
description: "List the tables and columns a semantic model exposes to SQL: one table per entity (name, kind, primaryKey) with its columns (name, DIMENSION or METRIC, dataType, isPrimary, the default aggregation of a metric). Use the names verbatim in sql_execute.",
|
|
1667
|
+
inputSchema: {
|
|
1668
|
+
modelId: zod.z.string().optional().describe("Semantic model ID; optional when the workspace has exactly one model")
|
|
1669
|
+
},
|
|
1670
|
+
annotations: { title: "SQL Catalog", ...READ_ONLY, openWorldHint: false }
|
|
1671
|
+
},
|
|
1672
|
+
async ({ modelId }) => {
|
|
1673
|
+
try {
|
|
1674
|
+
const data = await ctx.gql.workspace.request(SQL_CATALOG, modelId ? { modelId } : {});
|
|
1675
|
+
return jsonResult(data.semSqlCatalog);
|
|
1676
|
+
} catch (error) {
|
|
1677
|
+
ctx.logger.error("semanticfed sql_catalog failed", { error: String(error) });
|
|
1678
|
+
return errorResult(
|
|
1679
|
+
`Failed to read the SQL catalog: ${error instanceof Error ? error.message : String(error)}`
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1611
1685
|
|
|
1612
1686
|
// src/modules/semanticfed/resources.ts
|
|
1613
1687
|
function registerSemanticfedResources(server, ctx, track) {
|
|
@@ -1855,6 +1929,8 @@ Show results at each step and confirm before publishing.`
|
|
|
1855
1929
|
5. **Inspect**: Poll ${p}_query_runs_get (or ${p}_query_runs_list filtered by status) to watch QUEUED \u2192 PLANNING \u2192 RUNNING \u2192 SUCCEEDED and read rowCount / sourcesTouched / planSummary.
|
|
1856
1930
|
6. **Read results**: Call ${p}_query_runs_result with the run id to page through the governed rows (masked columns stay masked; filtered rows are absent).
|
|
1857
1931
|
|
|
1932
|
+
For a one-off question that does not need a saved query, call ${p}_sql_catalog to see the tables and columns, then ${p}_sql_execute with a single SELECT: it returns the governed rows directly (same access policies, no run to poll).
|
|
1933
|
+
|
|
1858
1934
|
Summarize what needs attention after each step.`
|
|
1859
1935
|
}
|
|
1860
1936
|
}
|
|
@@ -1899,6 +1975,7 @@ var semanticfedModule = {
|
|
|
1899
1975
|
registerRunTools(server, ctx, trackTool);
|
|
1900
1976
|
registerPolicyTools(server, ctx, trackTool);
|
|
1901
1977
|
registerHealthTools(server, ctx, trackTool);
|
|
1978
|
+
registerSqlTools(server, ctx, trackTool);
|
|
1902
1979
|
registerSemanticfedResources(server, ctx, trackResource);
|
|
1903
1980
|
registerSemanticfedPrompts(server, ctx, trackPrompt);
|
|
1904
1981
|
return { tools, resources, prompts };
|