Skip to main content
Glama
seanivore

MCP File Preview Server

analyze_content

Parse and evaluate the structure of HTML files to identify elements, hierarchy, and layout. Use this tool to extract meaningful insights from local HTML content for debugging or analysis.

Instructions

Analyze HTML content structure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to local HTML file

Implementation Reference

  • Core handler function in FilePreviewWrapper that reads the HTML file and uses regex to count structural elements: headings (h1-h6), paragraphs, images, and links.
    async analyzeContent(filePath: string) {
      if (!fs.existsSync(filePath)) {
        throw new McpError(ErrorCode.InvalidRequest, `File not found: ${filePath}`);
      }
    
      const content = fs.readFileSync(filePath, 'utf-8');
      
      return {
        headings: (content.match(/<h[1-6][^>]*>.*?<\/h[1-6]>/g) || []).length,
        paragraphs: (content.match(/<p[^>]*>.*?<\/p>/g) || []).length,
        images: (content.match(/<img[^>]*>/g) || []).length,
        links: (content.match(/<a[^>]*>.*?<\/a>/g) || []).length,
      };
    }
  • Tool object definition including name, description, and input schema specifying the required 'filePath' parameter.
    const analyzeContentTool: Tool = {
      name: 'analyze_content',
      description: 'Analyze HTML content structure',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: { type: 'string', description: 'Path to local HTML file' }
        },
        required: ['filePath']
      }
    };
  • src/index.ts:166-169 (registration)
    Registration of the analyze_content tool (along with preview_file) in the server's capabilities for tools.
    tools: {
      preview_file: previewFileTool,
      analyze_content: analyzeContentTool
    }
  • src/index.ts:241-243 (registration)
    Tool listing handler that returns the registered tools including analyze_content.
    return {
      tools: [previewFileTool, analyzeContentTool],
    };
  • Dispatch handler in CallToolRequestSchema that validates input, calls the analyzeContent method, and formats the response as JSON text.
    case "analyze_content": {
      const args = request.params.arguments as { filePath: string };
      if (!args.filePath) {
        throw new Error("Missing required argument: filePath");
      }
      const analysis = await filePreview.analyzeContent(args.filePath);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(analysis, null, 2)
          }
        ],
      };
    }
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. It only states what the tool does ('Analyze HTML content structure') without revealing any behavioral traits—such as whether it's read-only, destructive, requires specific permissions, handles errors, or has rate limits. This is a significant gap for a tool with no annotation coverage.

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

Conciseness4/5

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

The description is concise and front-loaded with a single phrase, 'Analyze HTML content structure', which efficiently conveys the core purpose without unnecessary words. However, it could be improved by adding a bit more context to enhance clarity without sacrificing brevity.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the analysis returns (e.g., structure details, errors, or metadata), behavioral aspects, or usage context. For a tool with no structured data beyond the input schema, this leaves significant gaps in understanding its full functionality.

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?

The input schema has 100% description coverage, with the parameter 'filePath' clearly documented as 'Path to local HTML file'. The description adds no additional meaning beyond this, as it doesn't elaborate on parameter usage or constraints. Given the high schema coverage, a baseline score of 3 is appropriate, as the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Analyze HTML content structure' states a clear verb ('Analyze') and resource ('HTML content structure'), but it's vague about what 'analyze' entails—does it extract metadata, validate structure, or something else? It doesn't differentiate from the sibling tool 'preview_file', which might also handle HTML files, leaving ambiguity in purpose.

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 is provided on when to use this tool versus alternatives. The description doesn't mention the sibling tool 'preview_file' or any other context for usage, such as prerequisites or scenarios where this tool is preferred. This leaves the agent without direction on tool selection.

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

Related 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/seanivore/mcp-file-preview'

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