Skip to content

Commit 024c9cc

Browse files
committed
resolve some devin review comments
1 parent 5c9788c commit 024c9cc

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

apps/webapp/app/routes/api.v1.query.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ const BodySchema = z.object({
1919
/** Extract table names from a TRQL query for authorization */
2020
function detectTables(query: string): string[] {
2121
return querySchemas
22-
.filter((s) => new RegExp(`\\bFROM\\s+${s.name}\\b`, "i").test(query))
22+
.filter((s) => {
23+
const escaped = s.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24+
return new RegExp(`\\bFROM\\s+${escaped}\\b`, "i").test(query);
25+
})
2326
.map((s) => s.name);
2427
}
2528

packages/cli-v3/src/mcp/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const toolsMetadata = {
116116
name: "get_query_schema",
117117
title: "Get Query Schema",
118118
description:
119-
"Get the column schema for a specific TRQL table. Available tables: 'runs' (task execution data), 'metrics' (CPU, memory, custom metrics), 'llm_metrics' (LLM token usage, costs, latency). Returns columns, types, descriptions, and allowed values for the specified table.",
119+
"Get the column schema for a specific TRQL table. Available tables: 'runs' (task execution data), 'metrics' (CPU, memory, custom metrics). Returns columns, types, descriptions, and allowed values for the specified table.",
120120
},
121121
list_dashboards: {
122122
name: "list_dashboards",

packages/cli-v3/src/mcp/tools.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ import {
2121
import { getCurrentWorker, getTaskSchemaTool, triggerTaskTool } from "./tools/tasks.js";
2222
import { respondWithError } from "./utils.js";
2323

24-
/** Tool names that perform write operations (deploy, trigger, cancel). */
24+
/** Tool names that perform write/mutating operations. */
2525
const WRITE_TOOLS = new Set([
2626
deployTool.name,
2727
triggerTaskTool.name,
2828
cancelRunTool.name,
29+
createProjectInOrgTool.name,
30+
initializeProjectTool.name,
2931
]);
3032

3133
export function registerTools(context: McpContext) {

packages/cli-v3/src/mcp/tools/dashboards.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ export const listDashboardsTool = {
3535
});
3636

3737
const cacheKey = `${projectRef}:${input.environment}:${input.branch ?? ""}`;
38-
const result = await apiClient.listDashboards();
39-
dashboardCache.set(cacheKey, { data: result, expiresAt: Date.now() + CACHE_TTL_MS });
38+
const cached = dashboardCache.get(cacheKey);
39+
let result: ListDashboardsResponseBody;
40+
if (cached && Date.now() < cached.expiresAt) {
41+
result = cached.data;
42+
} else {
43+
result = await apiClient.listDashboards();
44+
dashboardCache.set(cacheKey, { data: result, expiresAt: Date.now() + CACHE_TTL_MS });
45+
}
4046

4147
const content: string[] = ["## Available Dashboards", ""];
4248

0 commit comments

Comments
 (0)