@burdenoff/mcp-libs 2026.1107.3 → 2026.1107.4
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 +1 -1
|
@@ -352,6 +352,26 @@ var HEALTH = `
|
|
|
352
352
|
semHealth
|
|
353
353
|
}
|
|
354
354
|
`;
|
|
355
|
+
var EXECUTE_SQL = `
|
|
356
|
+
mutation SemExecuteSql($input: SemExecuteSqlInput!) {
|
|
357
|
+
semExecuteSql(input: $input) {
|
|
358
|
+
modelId
|
|
359
|
+
columns { name entity field aggregation dataType masked mask }
|
|
360
|
+
rows rowCount truncated durationMs sourcesTouched planSummary
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
`;
|
|
364
|
+
var SQL_CATALOG = `
|
|
365
|
+
query SemSqlCatalog($modelId: ID) {
|
|
366
|
+
semSqlCatalog(modelId: $modelId) {
|
|
367
|
+
modelId modelName
|
|
368
|
+
tables {
|
|
369
|
+
name kind primaryKey description
|
|
370
|
+
columns { name kind dataType isPrimary aggregation description }
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
`;
|
|
355
375
|
var ConnectorKindEnum = z.enum([
|
|
356
376
|
"BIGQUERY",
|
|
357
377
|
"CLICKHOUSE",
|
|
@@ -1546,6 +1566,60 @@ function registerHealthTools(server, ctx, track) {
|
|
|
1546
1566
|
}
|
|
1547
1567
|
);
|
|
1548
1568
|
}
|
|
1569
|
+
var READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true };
|
|
1570
|
+
function registerSqlTools(server, ctx, track) {
|
|
1571
|
+
server.registerTool(
|
|
1572
|
+
track(mcpToolName(ctx.productName, "sql_execute")),
|
|
1573
|
+
{
|
|
1574
|
+
title: "Execute SQL",
|
|
1575
|
+
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.",
|
|
1576
|
+
inputSchema: {
|
|
1577
|
+
sql: z.string().min(1).describe("One SELECT statement"),
|
|
1578
|
+
modelId: z.string().optional().describe("Semantic model ID; optional when the workspace has exactly one model"),
|
|
1579
|
+
maxRows: z.number().int().min(1).max(1e4).optional().describe("Maximum rows returned (default 1000, max 10000)"),
|
|
1580
|
+
timeoutMs: z.number().int().min(1e3).max(6e4).optional().describe("Execution time limit in milliseconds (default 30000)")
|
|
1581
|
+
},
|
|
1582
|
+
annotations: { title: "Execute SQL", ...READ_ONLY, openWorldHint: true }
|
|
1583
|
+
},
|
|
1584
|
+
async ({ sql, modelId, maxRows, timeoutMs }) => {
|
|
1585
|
+
try {
|
|
1586
|
+
const input = { sql };
|
|
1587
|
+
if (modelId) input.modelId = modelId;
|
|
1588
|
+
if (maxRows !== void 0) input.maxRows = maxRows;
|
|
1589
|
+
if (timeoutMs !== void 0) input.timeoutMs = timeoutMs;
|
|
1590
|
+
const data = await ctx.gql.workspace.request(EXECUTE_SQL, { input });
|
|
1591
|
+
return jsonResult(data.semExecuteSql);
|
|
1592
|
+
} catch (error) {
|
|
1593
|
+
ctx.logger.error("semanticfed sql_execute failed", { error: String(error) });
|
|
1594
|
+
return errorResult(
|
|
1595
|
+
`Failed to execute SQL: ${error instanceof Error ? error.message : String(error)}`
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
);
|
|
1600
|
+
server.registerTool(
|
|
1601
|
+
track(mcpToolName(ctx.productName, "sql_catalog")),
|
|
1602
|
+
{
|
|
1603
|
+
title: "SQL Catalog",
|
|
1604
|
+
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.",
|
|
1605
|
+
inputSchema: {
|
|
1606
|
+
modelId: z.string().optional().describe("Semantic model ID; optional when the workspace has exactly one model")
|
|
1607
|
+
},
|
|
1608
|
+
annotations: { title: "SQL Catalog", ...READ_ONLY, openWorldHint: false }
|
|
1609
|
+
},
|
|
1610
|
+
async ({ modelId }) => {
|
|
1611
|
+
try {
|
|
1612
|
+
const data = await ctx.gql.workspace.request(SQL_CATALOG, modelId ? { modelId } : {});
|
|
1613
|
+
return jsonResult(data.semSqlCatalog);
|
|
1614
|
+
} catch (error) {
|
|
1615
|
+
ctx.logger.error("semanticfed sql_catalog failed", { error: String(error) });
|
|
1616
|
+
return errorResult(
|
|
1617
|
+
`Failed to read the SQL catalog: ${error instanceof Error ? error.message : String(error)}`
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1549
1623
|
|
|
1550
1624
|
// src/modules/semanticfed/resources.ts
|
|
1551
1625
|
function registerSemanticfedResources(server, ctx, track) {
|
|
@@ -1793,6 +1867,8 @@ Show results at each step and confirm before publishing.`
|
|
|
1793
1867
|
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.
|
|
1794
1868
|
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).
|
|
1795
1869
|
|
|
1870
|
+
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).
|
|
1871
|
+
|
|
1796
1872
|
Summarize what needs attention after each step.`
|
|
1797
1873
|
}
|
|
1798
1874
|
}
|
|
@@ -1837,6 +1913,7 @@ var semanticfedModule = {
|
|
|
1837
1913
|
registerRunTools(server, ctx, trackTool);
|
|
1838
1914
|
registerPolicyTools(server, ctx, trackTool);
|
|
1839
1915
|
registerHealthTools(server, ctx, trackTool);
|
|
1916
|
+
registerSqlTools(server, ctx, trackTool);
|
|
1840
1917
|
registerSemanticfedResources(server, ctx, trackResource);
|
|
1841
1918
|
registerSemanticfedPrompts(server, ctx, trackPrompt);
|
|
1842
1919
|
return { tools, resources, prompts };
|