Skip to main content
Glama

analyze_link_graph

Visualize document connections in markdown projects to understand relationships and validate links using graph formats like mermaid, JSON, or DOT.

Instructions

Visualize connections between documents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
scopeNoFile scope pattern
formatNoOutput formatmermaid

Implementation Reference

  • Core implementation of the analyze_link_graph tool. Parses arguments, calls writersAid.checkLinks to get links, and returns a Mermaid graph or JSON based on format.
    private async analyzeLinkGraph(args: Record<string, unknown>) {
      const format = (args.format as string) || "mermaid";
      const scope = args.scope as string | undefined;
      const limit = resolvePaginationLimit("analyze_link_graph", args.limit as number | undefined);
    
      const links = await this.writersAid.checkLinks({ scope, limit });
    
      if (format === "mermaid") {
        return {
          format: "mermaid",
          graph: "graph TD\n  A[Chapter 1] --> B[Chapter 2]\n  B --> C[Chapter 3]",
        };
      }
    
      return { links, format };
    }
  • Tool registration in the handleTool switch statement that dispatches to the analyzeLinkGraph handler.
    case "analyze_link_graph":
      return this.analyzeLinkGraph(args);
  • MCP tool schema definition including input parameters (project_path, scope, format) for the analyze_link_graph tool.
    {
      name: "analyze_link_graph",
      description: "Visualize connections between documents",
      inputSchema: {
        type: "object",
        properties: {
          project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" },
          scope: { type: "string", description: "File scope pattern" },
          format: {
            type: "string",
            enum: ["mermaid", "json", "dot"],
            description: "Output format",
            default: "mermaid",
          },
        },
      },
    },
  • TypeScript interface defining the response structure for the analyze_link_graph tool.
    /**
     * Response from analyze_link_graph tool
     */
    export interface AnalyzeLinkGraphResponse {
      graph: LinkGraph;
      orphaned_files: string[];
      broken_links: MarkdownLink[];
      format: 'json' | 'mermaid' | 'dot';
      visualization?: string;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. 'Visualize' suggests a read-only operation that generates output, but there's no mention of what kind of visualization is produced, whether it's interactive or static, how large document sets are handled, or any performance considerations. The description doesn't contradict annotations (none exist), but provides insufficient behavioral context.

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?

The description is a single, efficient phrase that communicates the core function without unnecessary words. It's appropriately sized for a tool with good schema documentation and gets straight to the point with zero wasted verbiage.

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

Completeness2/5

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

Given the tool's complexity (visualization with multiple parameters) and the absence of both annotations and output schema, the description is insufficiently complete. It doesn't explain what the visualization output looks like, how to interpret it, what 'connections' specifically means, or any limitations of the analysis. For a visualization tool with no output schema, more context about the result format and interpretation would be expected.

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

Parameters3/5

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

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema - it doesn't explain how 'project_path' relates to the visualization, what 'scope' patterns are meaningful, or when to choose different 'format' options. The baseline score of 3 reflects adequate but unenhanced parameter documentation.

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?

The description 'Visualize connections between documents' clearly states the tool's function with a specific verb ('visualize') and resource ('connections between documents'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'trace_reference_chain' or 'find_related_sections' that might also deal with document relationships.

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?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools dealing with document analysis and relationships (like 'trace_reference_chain', 'find_related_sections', 'holistic_search'), there's no indication of what makes this visualization tool distinct or when it's the appropriate choice.

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/xiaolai/claude-writers-aid-mcp'

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