fix: checks for doc cache on mcp tool call (#514)

This commit is contained in:
Aliyan Ishfaq 2025-07-24 08:59:45 -07:00 • committed by GitHub
parent c0e557cdb7
commit 00dafbe535
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,6 +38,14 @@ export async function processToolCallContent(
const url = toolCall.args?.url || toolCall.args?.uri || toolCall.args?.path;
const parsedResult = typeof url === "string" ? parseUrl(url) : null;
const parsedUrl = parsedResult?.success ? parsedResult.url.href : undefined;
// avoid generating TOC again if it's already in the cache
if (parsedUrl && state.documentCache[parsedUrl]) {
return {
content: state.documentCache[parsedUrl],
};
}
const processedContent = await handleMcpDocumentationOutput(
result,
config,