Home / File/ overview.ts — mcp Source File

overview.ts — mcp Source File

Architecture documentation for overview.ts, a typescript file in the mcp codebase. 13 imports, 1 dependents.

File typescript AnalysisTools OverviewRenderer 13 imports 1 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  242ec636_ba33_547c_5cb6_5f619c73d099["overview.ts"]
  5c6acde2_5ba8_604f_70ae_120f7b72feaa["types.ts"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 5c6acde2_5ba8_604f_70ae_120f7b72feaa
  c4c0fa2d_6600_6cac_6763_168919269bad["Endpoint"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> c4c0fa2d_6600_6cac_6763_168919269bad
  904f44eb_66f1_9575_c86d_de4c934b974c["HandlerFunction"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 904f44eb_66f1_9575_c86d_de4c934b974c
  4d61d2d9_1e21_bfa3_9ab1_b3a87cf498d7["asTextContentResult"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 4d61d2d9_1e21_bfa3_9ab1_b3a87cf498d7
  cbd676af_ec21_66d2_a9cd_83a383d7bc5b["asErrorResult"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> cbd676af_ec21_66d2_a9cd_83a383d7bc5b
  108c9ff4_bdb8_518a_9256_9ff4cd9d39a7["graph-cache.ts"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 108c9ff4_bdb8_518a_9256_9ff4cd9d39a7
  1e5728cd_d35b_2e55_1a1e_fbf2decd1090["IndexedGraph"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 1e5728cd_d35b_2e55_1a1e_fbf2decd1090
  0c2dbb97_347e_7226_4d31_fbdcb85ac22b["resolveOrFetchGraph"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 0c2dbb97_347e_7226_4d31_fbdcb85ac22b
  59a82797_f6a2_36aa_02bd_7b2f22d1bc50["normalizePath"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 59a82797_f6a2_36aa_02bd_7b2f22d1bc50
  4bef1572_5a60_651d_3247_2779d2e6bd57["api-helpers.ts"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 4bef1572_5a60_651d_3247_2779d2e6bd57
  1595e523_decc_c3ce_72e9_f77eb66bef69["classifyApiError"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 1595e523_decc_c3ce_72e9_f77eb66bef69
  19f4d048_f875_3a64_f6f5_2d534dca972b["constants.ts"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 19f4d048_f875_3a64_f6f5_2d534dca972b
  8c03d5ca_533e_b509_c9c8_f2625f78856a["types.js"]
  242ec636_ba33_547c_5cb6_5f619c73d099 --> 8c03d5ca_533e_b509_c9c8_f2625f78856a
  54581714_e921_5e5e_17c6_d2040cdc3b55["server.ts"]
  54581714_e921_5e5e_17c6_d2040cdc3b55 --> 242ec636_ba33_547c_5cb6_5f619c73d099
  style 242ec636_ba33_547c_5cb6_5f619c73d099 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * `overview` tool -- instant architectural map of a codebase.
 *
 * Returns a concise (<3KB) markdown summary with:
 *  - Top domains and their key files
 *  - Hub functions (highest in-degree in call graph)
 *  - File/function/class counts
 *
 * Backed by pre-computed graphs (sub-second) with on-demand API fallback.
 */

import { Tool } from '@modelcontextprotocol/sdk/types.js';
import {
  Endpoint,
  HandlerFunction,
  asTextContentResult,
  asErrorResult,
} from '../types';
import {
  IndexedGraph,
  resolveOrFetchGraph,
  normalizePath,
} from '../cache/graph-cache';
import { classifyApiError } from '../utils/api-helpers';
import {
  MAX_OVERVIEW_DOMAINS,
  MAX_OVERVIEW_HUB_FUNCTIONS,
} from '../constants';

export const tool: Tool = {
  name: 'overview',
  description:
    `Returns a pre-computed architectural map of the entire codebase: which domains own which files, the most-called hub functions (call graph centrality), file/function/class counts. Sub-second, zero cost. Useful when you need to understand the overall structure before diving in. Skip this if you already know what file or symbol to investigate — use symbol_context or file reading instead.`,
  inputSchema: {
    type: 'object',
    properties: {
      directory: {
        type: 'string',
        description:
          'Path to the repository directory. Omit if the MCP server was started with a default workdir.',
      },
    },
    required: [],
  },
};

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.',
    });
  }

// ... (118 more lines)

Domain

Subdomains

Imported By

Frequently Asked Questions

What does overview.ts do?
overview.ts is a source file in the mcp codebase, written in typescript. It belongs to the AnalysisTools domain, OverviewRenderer subdomain.
What functions are defined in overview.ts?
overview.ts defines 5 function(s): getHubFunctions, getKeyFilesForDomain, handler, renderOverview, truncate.
What does overview.ts depend on?
overview.ts imports 13 module(s): Endpoint, HandlerFunction, IndexedGraph, api-helpers.ts, asErrorResult, asTextContentResult, classifyApiError, constants.ts, and 5 more.
What files import overview.ts?
overview.ts is imported by 1 file(s): server.ts.
Where is overview.ts in the architecture?
overview.ts is located at src/tools/overview.ts (domain: AnalysisTools, subdomain: OverviewRenderer, directory: src/tools).

Analyze Your Own Codebase

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

Try Supermodel Free