From 4f10af68dfa1f80521f1ea4b96116b146e08b392 Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Tue, 22 Sep 2026 21:07:51 +0200 Subject: [PATCH] docs: rank the page titled with the query first in MCP search --- docs/functions/mcp.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/functions/mcp.ts b/docs/functions/mcp.ts index bbd6c78c..970f2419 100644 --- a/docs/functions/mcp.ts +++ b/docs/functions/mcp.ts @@ -132,6 +132,9 @@ function scorePage(page: ManifestPage, terms: RegExp[]): number { if (countMatches(description, term) > 0) score += 3; score += Math.min(countMatches(text, term), 5); } + // A page titled with every query term is the page being asked for, even + // when a broader page (e.g. the API reference) mentions the terms more. + if (terms.every((term) => countMatches(title, term) > 0)) score += 10; return score; }