Skip to main content
Glama
c0sc0s
by c0sc0s

Discover Repository Structure

discover_repository_structure

Analyze local codebase structure to identify workspace files, monorepo packages, TypeScript configurations, and package classification details for enhanced project understanding.

Instructions

Inspect a local root path and return workspace files, monorepo packages, tsconfig files, and package classification hints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rootYes

Implementation Reference

  • The handler registration for discover_repository_structure, which calls the inspectRepository function.
    server.registerTool(
      "discover_repository_structure",
      {
        title: "Discover Repository Structure",
        description: "Inspect a local root path and return workspace files, monorepo packages, tsconfig files, and package classification hints.",
        inputSchema: rootSchema,
      },
      async (args: InspectRepositoryArgs) => {
        const repository = inspectRepository(args.root);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(repository, null, 2),
            },
          ],
          structuredContent: repository,
        };
      },
    );
  • The core logic implementation of repository inspection for discover_repository_structure.
    export function inspectRepository(root: string): RepositoryDiscoveryResult {
      const normalizedRoot = toSearchRoot(root);
      const directories = collectDirectories(normalizedRoot);
      const workspaceFiles = collectWorkspaceFiles(normalizedRoot);
      const tsconfigPaths = directories.flatMap((directory) => findDirectChildren(directory, PACKAGE_TSCONFIG_NAMES));
      const packageJsonPaths = directories
        .map((directory) => path.join(directory, "package.json"))
        .filter((packageJsonPath) => fs.existsSync(packageJsonPath));
      const packages = packageJsonPaths.map((packageJsonPath) => inspectPackage(packageJsonPath)).sort(comparePackageInfo);
    
      return {
        root: normalizedRoot,
        workspaceFiles: workspaceFiles.sort(compareByPath),
        tsconfigPaths: uniquePaths(tsconfigPaths),
        packages,
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses what data is returned (files, packages, hints), but lacks safety confirmation (read-only nature), performance characteristics (scanning cost), or error behavior given zero annotations. 'Inspect' implies read-only but doesn't guarantee it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, 16 words. Front-loaded action verb followed by parameter reference and return value enumeration. No redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Lists return categories compensating for missing output schema, but omits parameter format details, error cases, and return structure shape needed for a tool with zero annotations and 0% schema coverage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema coverage, the description compensates by specifying 'local root path', confirming the parameter represents a filesystem path to project root. Could further clarify absolute vs. relative paths.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb ('Inspect') and resource ('local root path'), with specific enumerated outputs (workspace files, monorepo packages, tsconfig files, classification hints) that distinguish it from symbol-focused siblings like get_definition and get_references.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use versus alternatives, prerequisites (e.g., path must exist), or relationship to sibling tools like get_web_project_context. Purely descriptive without strategic direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/c0sc0s/agent-workspace-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server