Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

format_scraped_data

Convert scraped data into structured formats like JSON, Markdown, or CSV for analysis and integration.

Instructions

Format scraped data into different output formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesScraped data object
formatNoOutput formatmarkdown

Implementation Reference

  • Handler for the 'format_scraped_data' tool. Processes input data and format parameter, calling Formatters.formatScrapedData for markdown-formatted ScrapedData objects.
    case 'format_scraped_data': {
      const data = params.data as Record<string, unknown>;
      const format = (params.format as string) || 'markdown';
      
      if (format === 'json') {
        return Formatters.formatJSON(data);
      } else if (format === 'markdown') {
        // Use formatter if it's ScrapedData
        if (data.url && data.scrapedAt) {
          return Formatters.formatScrapedData(data as any);
        }
        return Formatters.formatJSON(data);
      } else if (format === 'csv') {
        // Convert to CSV format
        return 'CSV format not yet implemented';
      }
      return data;
    }
  • Input schema definition for the 'format_scraped_data' tool, specifying data object and optional format (json/markdown/csv).
    inputSchema: {
      type: 'object',
      properties: {
        data: {
          type: 'object',
          description: 'Scraped data object',
        },
        format: {
          type: 'string',
          enum: ['json', 'markdown', 'csv'],
          description: 'Output format',
          default: 'markdown',
        },
      },
      required: ['data'],
    },
  • Registration of the 'format_scraped_data' tool in the apiDiscoveryTools array.
    {
      name: 'format_scraped_data',
      description: 'Format scraped data into different output formats',
      inputSchema: {
        type: 'object',
        properties: {
          data: {
            type: 'object',
            description: 'Scraped data object',
          },
          format: {
            type: 'string',
            enum: ['json', 'markdown', 'csv'],
            description: 'Output format',
            default: 'markdown',
          },
        },
        required: ['data'],
      },
    },
  • Core helper function that formats ScrapedData into a comprehensive markdown report including title, text, links, images, and tables.
    static formatScrapedData(data: ScrapedData): string {
      let output = `# Scraped Data: ${data.url}\n\n`;
      output += `**Scraped At:** ${data.scrapedAt.toISOString()}\n\n`;
    
      if (data.title) {
        output += `**Title:** ${data.title}\n\n`;
      }
    
      if (data.text) {
        output += `## Text Content\n\n${data.text.substring(0, 1000)}${data.text.length > 1000 ? '...' : ''}\n\n`;
      }
    
      if (data.links && data.links.length > 0) {
        output += `## Links (${data.links.length})\n\n`;
        for (const link of data.links.slice(0, 20)) {
          output += `- ${link}\n`;
        }
        if (data.links.length > 20) {
          output += `\n... and ${data.links.length - 20} more links\n`;
        }
        output += '\n';
      }
    
      if (data.images && data.images.length > 0) {
        output += `## Images (${data.images.length})\n\n`;
        for (const img of data.images.slice(0, 10)) {
          output += `- ${img}\n`;
        }
        if (data.images.length > 10) {
          output += `\n... and ${data.images.length - 10} more images\n`;
        }
        output += '\n';
      }
    
      if (data.tables && data.tables.length > 0) {
        output += `## Tables (${data.tables.length})\n\n`;
        for (const table of data.tables) {
          if (table.caption) {
            output += `### ${table.caption}\n\n`;
          }
          if (table.headers.length > 0) {
            output += '| ' + table.headers.join(' | ') + ' |\n';
            output += '|' + table.headers.map(() => '---').join('|') + '|\n';
            for (const row of table.rows.slice(0, 10)) {
              output += '| ' + row.join(' | ') + ' |\n';
            }
            if (table.rows.length > 10) {
              output += `\n... and ${table.rows.length - 10} more rows\n`;
            }
          }
          output += '\n';
        }
      }
    
      return output;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic function without disclosing behavioral traits. It doesn't cover aspects like whether formatting is idempotent, error handling for invalid data, performance implications, or output structure, which are critical for a tool that transforms data.

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 sentence that front-loads the core purpose without unnecessary words. Every part earns its place by directly stating the tool's function, making it highly concise and well-structured.

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 complexity of data formatting (2 parameters, nested objects, no output schema), the description is incomplete. It lacks details on output behavior, error cases, or how formats like CSV handle structured data, leaving gaps that could hinder correct tool invocation despite good schema coverage.

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?

Schema description coverage is 100%, so the schema fully documents parameters ('data' as a scraped object, 'format' as an enum with default). The description adds no extra meaning beyond implying 'data' should be scraped, which is minimal value over the schema, meeting the baseline for high coverage.

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 clearly states the verb ('format') and resource ('scraped data'), specifying the action of converting data into different output formats. It distinguishes from siblings like 'scrape_by_selector' or 'extract_text' by focusing on post-processing rather than extraction, though it doesn't explicitly contrast with 'parse_csv' or 'parse_json' which handle specific formats.

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. It doesn't mention prerequisites (e.g., needing scraped data as input), exclusions, or comparisons to sibling tools like 'parse_csv' or 'parse_json', leaving the agent to infer usage context.

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/code-alchemist01/development-tools-mcp-Server'

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