Fix review comments: use performance.now() for cache TTL, pass mcpToolName to getTools()

Co-Authored-By: mantra <mantra@stack-auth.com>
This commit is contained in:
Devin AI 2026-06-18 17:51:37 +00:00
parent 554dd9007c
commit e0dc388c64
2 changed files with 6 additions and 2 deletions

View File

@ -63,7 +63,11 @@ export const POST = createSmartRouteHandler({
systemPrompt += await getVerifiedQaContext();
}
systemPrompt += await getMcpSkillContextPrompt(body.mcpCallMetadata?.toolName);
const tools = await getTools(toolNames, { auth: fullReq.auth, targetProjectId: projectId });
const tools = await getTools(toolNames, {
auth: fullReq.auth,
targetProjectId: projectId,
mcpToolName: body.mcpCallMetadata?.toolName,
});
const toolsArg = Object.keys(tools).length > 0 ? tools : undefined;
const isCreateDashboard = systemPromptId === "create-dashboard";
const isBuildAnalyticsQuery = systemPromptId === "build-analytics-query";

View File

@ -5,7 +5,7 @@ const CACHE_TTL_MS = 5 * 60 * 1_000; // 5 minutes
let cachedDocs: { text: string, fetchedAt: number } | null = null;
async function fetchDocsText(): Promise<string> {
const now = Date.now();
const now = performance.now();
if (cachedDocs && now - cachedDocs.fetchedAt < CACHE_TTL_MS) {
return cachedDocs.text;
}