API reference: @salmonui/mcp
SalmonToolsclass
import { SalmonTools } from '@salmonui/mcp';class SalmonTools {
#private;
readonly index: McpIndex;
readonly map: ExportsMap;
constructor(index: McpIndex);
call(name: string, args: Readonly<Record<string, unknown>>): ToolResult;
url(path: string): string;
get symbolsByName(): Map<string, IndexSymbol[]>;
listComponents(filter?: string): ToolResult;
get docsSearch(): {
bm25: Bm25;
refs: {
doc: IndexDoc;
section: number;
}[];
};
rankDocs(query: string): {
doc: IndexDoc;
score: number;
sections: {
index: number;
score: number;
}[];
}[];
searchDocs(query: string, limit: number): ToolResult;
docsMentioning(name: string, max?: number): IndexDoc[];
referenceUrl(specifier: string): string;
stylesheetLines(specifier: string): string[];
getComponent(rawName: string): ToolResult;
suggestNames(name: string, max?: number): string[];
describeFamily(pkg: IndexPackage, family: IndexFamily): string;
describeSymbol(symbol: IndexSymbol, { header }?: {
header?: string;
}): string;
propsOf(symbol: IndexSymbol): {
members: IndexMember[];
from: string;
alias?: string;
} | undefined;
get demoSearch(): Bm25;
getExample(id?: string, query?: string): ToolResult;
checkImports(source: string, stylesheets?: boolean): ToolResult;
}
The tools bound to one index; lookup structures are built lazily, once.
| Name | Signature | Description |
|---|---|---|
__#1@#private | #private; | |
index | readonly index: McpIndex; | |
map | readonly map: ExportsMap; | |
call | call(name: string, args: Readonly<Record<string, unknown>>): ToolResult; | |
url | url(path: string): string; | |
symbolsByName | get symbolsByName(): Map<string, IndexSymbol[]>; | |
listComponents | listComponents(filter?: string): ToolResult; | |
docsSearch | get docsSearch(): {
bm25: Bm25;
refs: {
doc: IndexDoc;
section: number;
}[];
}; | |
rankDocs | rankDocs(query: string): {
doc: IndexDoc;
score: number;
sections: {
index: number;
score: number;
}[];
}[]; | Pages for a query: per page, the best section scores, best first. |
searchDocs | searchDocs(query: string, limit: number): ToolResult; | |
docsMentioning | docsMentioning(name: string, max?: number): IndexDoc[]; | Docs pages that name a symbol in code, most mentions first. |
referenceUrl | referenceUrl(specifier: string): string; | |
stylesheetLines | stylesheetLines(specifier: string): string[]; | |
getComponent | getComponent(rawName: string): ToolResult; | |
suggestNames | suggestNames(name: string, max?: number): string[]; | |
describeFamily | describeFamily(pkg: IndexPackage, family: IndexFamily): string; | |
describeSymbol | describeSymbol(symbol: IndexSymbol, { header }?: {
header?: string;
}): string; | |
propsOf | propsOf(symbol: IndexSymbol): {
members: IndexMember[];
from: string;
alias?: string;
} | undefined; | The props of a component (its |
demoSearch | get demoSearch(): Bm25; | |
getExample | getExample(id?: string, query?: string): ToolResult; | |
checkImports | checkImports(source: string, stylesheets?: boolean): ToolResult; |