Home / Function/ handler() — mcp Function Reference

handler() — mcp Function Reference

Architecture documentation for the handler() function in overview.ts from the mcp codebase.

Entity Profile

Dependency Diagram

graph TD
  b0737d71_130b_01b2_dbd7_14cb5f04946b["handler()"]
  242ec636_ba33_547c_5cb6_5f619c73d099["overview.ts"]
  b0737d71_130b_01b2_dbd7_14cb5f04946b -->|defined in| 242ec636_ba33_547c_5cb6_5f619c73d099
  6471f5ca_fcb9_6e5d_af84_17b245dc7c0f["setupHandlers()"]
  6471f5ca_fcb9_6e5d_af84_17b245dc7c0f -->|calls| b0737d71_130b_01b2_dbd7_14cb5f04946b
  cbd676af_ec21_66d2_a9cd_83a383d7bc5b["asErrorResult()"]
  b0737d71_130b_01b2_dbd7_14cb5f04946b -->|calls| cbd676af_ec21_66d2_a9cd_83a383d7bc5b
  0c2dbb97_347e_7226_4d31_fbdcb85ac22b["resolveOrFetchGraph()"]
  b0737d71_130b_01b2_dbd7_14cb5f04946b -->|calls| 0c2dbb97_347e_7226_4d31_fbdcb85ac22b
  4d61d2d9_1e21_bfa3_9ab1_b3a87cf498d7["asTextContentResult()"]
  b0737d71_130b_01b2_dbd7_14cb5f04946b -->|calls| 4d61d2d9_1e21_bfa3_9ab1_b3a87cf498d7
  aea9c930_f1b1_d4dc_72c2_803aeb181aad["renderOverview()"]
  b0737d71_130b_01b2_dbd7_14cb5f04946b -->|calls| aea9c930_f1b1_d4dc_72c2_803aeb181aad
  1595e523_decc_c3ce_72e9_f77eb66bef69["classifyApiError()"]
  b0737d71_130b_01b2_dbd7_14cb5f04946b -->|calls| 1595e523_decc_c3ce_72e9_f77eb66bef69
  style b0737d71_130b_01b2_dbd7_14cb5f04946b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/tools/overview.ts lines 47–67

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

Called By

Frequently Asked Questions

What does handler() do?
handler() is a function in the mcp codebase, defined in src/tools/overview.ts.
Where is handler() defined?
handler() is defined in src/tools/overview.ts at line 47.
What does handler() call?
handler() calls 5 function(s): asErrorResult, asTextContentResult, classifyApiError, renderOverview, resolveOrFetchGraph.
What calls handler()?
handler() is called by 1 function(s): setupHandlers.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free