handler() — mcp Function Reference
Architecture documentation for the handler() function in overview.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 7623ea08_e684_62f6_f74f_3b1d646a26f5["handler()"] 05b504b7_268e_7c49_d109_73f7c3744be0["asErrorResult()"] 7623ea08_e684_62f6_f74f_3b1d646a26f5 -->|calls| 05b504b7_268e_7c49_d109_73f7c3744be0 1721f7fd_bb7b_c8c3_9b4b_5677293ae256["resolveOrFetchGraph()"] 7623ea08_e684_62f6_f74f_3b1d646a26f5 -->|calls| 1721f7fd_bb7b_c8c3_9b4b_5677293ae256 67622b0f_6b47_8f68_bac5_409b3145d2f2["asTextContentResult()"] 7623ea08_e684_62f6_f74f_3b1d646a26f5 -->|calls| 67622b0f_6b47_8f68_bac5_409b3145d2f2 d8e22e5c_06d6_3c1a_d1ff_f9f562d53e5d["renderOverview()"] 7623ea08_e684_62f6_f74f_3b1d646a26f5 -->|calls| d8e22e5c_06d6_3c1a_d1ff_f9f562d53e5d f8f0f24b_951e_04ad_fb80_1ae3dde982e9["classifyApiError()"] 7623ea08_e684_62f6_f74f_3b1d646a26f5 -->|calls| f8f0f24b_951e_04ad_fb80_1ae3dde982e9 style 7623ea08_e684_62f6_f74f_3b1d646a26f5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/tools/overview.ts lines 50–70
export const handler: HandlerFunction = async (client, args, defaultWorkdir) => {
const rawDir = args?.directory as string | undefined;
const directory = (rawDir && rawDir.trim()) || defaultWorkdir || process.cwd();
if (!directory || typeof directory !== 'string') {
return asErrorResult({
type: 'validation_error',
message: 'No directory provided and no default workdir configured.',
code: 'MISSING_DIRECTORY',
recoverable: false,
suggestion: 'Provide a directory parameter or start the MCP server with a workdir argument.',
});
}
try {
const graph = await resolveOrFetchGraph(client, directory);
return asTextContentResult(renderOverview(graph));
} catch (error: any) {
return asErrorResult(classifyApiError(error));
}
};
Domain
Subdomains
Source
Frequently Asked Questions
What does handler() do?
handler() is a function in the mcp codebase.
What does handler() call?
handler() calls 5 function(s): asErrorResult, asTextContentResult, classifyApiError, renderOverview, resolveOrFetchGraph.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free