annotateHandler() — mcp Function Reference
Architecture documentation for the annotateHandler() function in tool-variants.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 0dc81adb_6983_30fe_6ae1_4620d20c0ff0["annotateHandler()"] 05b504b7_268e_7c49_d109_73f7c3744be0["asErrorResult()"] 0dc81adb_6983_30fe_6ae1_4620d20c0ff0 -->|calls| 05b504b7_268e_7c49_d109_73f7c3744be0 1721f7fd_bb7b_c8c3_9b4b_5677293ae256["resolveOrFetchGraph()"] 0dc81adb_6983_30fe_6ae1_4620d20c0ff0 -->|calls| 1721f7fd_bb7b_c8c3_9b4b_5677293ae256 2d87a17c_e46f_9198_c263_81d7c3c3054e["findSymbol()"] 0dc81adb_6983_30fe_6ae1_4620d20c0ff0 -->|calls| 2d87a17c_e46f_9198_c263_81d7c3c3054e 67622b0f_6b47_8f68_bac5_409b3145d2f2["asTextContentResult()"] 0dc81adb_6983_30fe_6ae1_4620d20c0ff0 -->|calls| 67622b0f_6b47_8f68_bac5_409b3145d2f2 233a620a_de76_be53_26cd_6e06fbe25d41["renderBriefSymbolContext()"] 0dc81adb_6983_30fe_6ae1_4620d20c0ff0 -->|calls| 233a620a_de76_be53_26cd_6e06fbe25d41 style 0dc81adb_6983_30fe_6ae1_4620d20c0ff0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/tools/tool-variants.ts lines 266–298
const annotateHandler: HandlerFunction = async (client, args, defaultWorkdir) => {
const symbol = typeof args?.symbol === 'string' ? args.symbol.trim() : '';
if (!symbol) {
return asErrorResult({
type: 'validation_error',
message: 'Missing required "symbol" parameter.',
code: 'MISSING_SYMBOL',
recoverable: false,
});
}
const rawDir = args?.directory as string | undefined;
const directory = (rawDir && rawDir.trim()) || defaultWorkdir || process.cwd();
let graph: IndexedGraph;
try {
graph = await resolveOrFetchGraph(client, directory);
} catch (error: any) {
return asErrorResult({ type: 'internal_error', message: error.message, code: 'GRAPH_ERROR', recoverable: false });
}
const matches = findSymbol(graph, symbol);
if (matches.length === 0) {
return asTextContentResult(`No symbol matching "${symbol}" found.`);
}
const parts = matches.slice(0, 3).map(node => renderBriefSymbolContext(graph, node));
let result = parts.join('\n---\n\n');
if (matches.length > 3) {
result += `\n\n*... and ${matches.length - 3} more matches.*`;
}
return asTextContentResult(result);
};
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does annotateHandler() do?
annotateHandler() is a function in the mcp codebase.
What does annotateHandler() call?
annotateHandler() calls 5 function(s): asErrorResult, asTextContentResult, findSymbol, renderBriefSymbolContext, resolveOrFetchGraph.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free