T-134: M2.1d — MCP copilot search_symbols tool: vault-safe security-master symbol lookup via an injected SymbolSearchPort in libs/research/src/mcp/tools/
This commit is contained in:
parent
857eedf379
commit
4c810cb249
2 changed files with 33 additions and 6 deletions
|
|
@ -242,7 +242,7 @@ function fenceAndProjectRow(
|
|||
};
|
||||
}
|
||||
|
||||
function matchRank(row: SymbolSearchRow, normalizedQuery: string): number {
|
||||
function matchRank(row: SymbolSearchRow, normalizedQuery: string): number | null {
|
||||
const normalizedTicker = row.ticker.toLowerCase();
|
||||
if (normalizedTicker === normalizedQuery) {
|
||||
return 0;
|
||||
|
|
@ -253,7 +253,7 @@ function matchRank(row: SymbolSearchRow, normalizedQuery: string): number {
|
|||
if (row.name.toLowerCase().includes(normalizedQuery)) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
return null;
|
||||
}
|
||||
|
||||
function validateFactoryOptions(options: SearchSymbolsToolOptions): number {
|
||||
|
|
@ -322,7 +322,10 @@ export function createSearchSymbolsTool(options: SearchSymbolsToolOptions): McpT
|
|||
input.includeDelisted
|
||||
);
|
||||
if (fenced !== null) {
|
||||
eligible.push({ row: fenced, rank: matchRank(fenced, normalizedQuery) });
|
||||
const rank = matchRank(fenced, normalizedQuery);
|
||||
if (rank !== null) {
|
||||
eligible.push({ row: fenced, rank });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue