Skip to main content
Glama
idapixl

MCP Starter Kit

transform_data

Convert data between formats like JSON, CSV, TSV, Markdown tables, and text summaries to reformat API responses, prepare data for display, or normalize spreadsheet exports.

Instructions

Convert data between formats: JSON, CSV, TSV, Markdown table, and plain text summary. Useful for reformatting API responses, preparing data for display, or normalising spreadsheet exports.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe raw input data to transform
from_formatYesInput data format
to_formatYesDesired output format
optionsNo

Implementation Reference

  • The main handler function for the `transform_data` tool, which manages input parsing, normalization, and formatting.
    export async function transformData(
      input: TransformDataInput
    ): Promise<ToolResult<TransformDataResult>> {
      const { from_format, to_format } = input;
      const options = input.options ?? {};
      const pretty = options.pretty ?? true;
      const include_header = options.include_header ?? true;
      const delimiter = options.delimiter;
    
      if (input.input.length > config.transformerMaxInput) {
        return {
          ok: false,
          error: `Input exceeds maximum size of ${config.transformerMaxInput} characters`,
          code: "INPUT_TOO_LARGE",
        };
      }
    
      logger.debug("Transforming data", { from_format, to_format });
    
      // Determine actual delimiters
      const inputDelimiter = delimiter ?? (from_format === "tsv" ? "\t" : ",");
      const outputDelimiter = to_format === "tsv" ? "\t" : ",";
    
      let parsed: unknown;
      try {
        if (from_format === "json") {
          parsed = parseJson(input.input);
        } else if (from_format === "csv" || from_format === "tsv") {
          parsed = parseCsvOrTsv(input.input, inputDelimiter);
        } else {
          parsed = parseText(input.input);
        }
      } catch (err) {
        return {
          ok: false,
          error: `Failed to parse input as ${from_format}: ${(err as Error).message}`,
          code: "PARSE_ERROR",
        };
      }
    
      let normalised: { headers: string[]; rows: string[][] };
      try {
        normalised = normalise(parsed, from_format);
      } catch (err) {
        return {
          ok: false,
          error: `Failed to normalise data: ${(err as Error).message}`,
          code: "NORMALISE_ERROR",
        };
      }
    
      let output: string;
      try {
        switch (to_format) {
          case "json":
            output = toJson(normalised, pretty);
            break;
          case "csv":
            output = toCsvOrTsv(normalised, ",", include_header);
            break;
          case "tsv":
            output = toCsvOrTsv(normalised, outputDelimiter, include_header);
            break;
          case "markdown_table":
            output = toMarkdownTable(normalised);
            break;
          case "text_summary":
            output = toTextSummary(normalised);
            break;
          default:
            return {
              ok: false,
              error: `Unknown to_format: ${to_format as string}`,
              code: "UNKNOWN_FORMAT",
            };
        }
      } catch (err) {
        return {
          ok: false,
          error: `Failed to format output as ${to_format}: ${(err as Error).message}`,
          code: "FORMAT_ERROR",
        };
      }
    
      logger.info("Transform complete", {
        from_format,
        to_format,
        rows: normalised.rows.length,
      });
    
      return {
        ok: true,
        data: {
          input_format: from_format,
          output_format: to_format,
          output,
          rows_processed: normalised.rows.length,
          transformed_at: new Date().toISOString(),
        },
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions what the tool does, it doesn't describe important behavioral aspects like error handling, performance characteristics, rate limits, authentication requirements, or what happens with malformed input. The description is functional but lacks operational transparency.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core functionality with specific format examples, and the second sentence provides usage contexts. No wasted words, front-loaded with the essential information.

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?

For a 4-parameter tool with no annotations and no output schema, the description is adequate but has clear gaps. It explains what the tool does and when to use it, but doesn't address output format details, error conditions, or behavioral constraints. Given the complexity and lack of structured metadata, more complete operational guidance would be helpful.

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 75% schema description coverage, the baseline is 3. The description doesn't add specific parameter semantics beyond what's in the schema - it mentions format conversions generally but doesn't explain parameter interactions, constraints, or edge cases. The schema already documents parameters well, so the description doesn't compensate for the 25% coverage gap but doesn't need to either.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('convert', 'reformat', 'prepare', 'normalise') and resources ('data between formats'), listing all supported formats. It distinguishes this from sibling tools (fetch_url, list_directory, read_file) by focusing on data transformation rather than data retrieval or file operations.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('useful for reformatting API responses, preparing data for display, or normalising spreadsheet exports'), giving concrete scenarios. However, it doesn't explicitly state when NOT to use it or mention alternatives among sibling tools, which prevents a perfect score.

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/idapixl/mcp-starter-kit'

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