Skip to main content
Glama

export_to_csv

Convert Excel worksheet data to CSV format using file paths and sheet names for accurate and structured data export.

Instructions

ワークシートをCSVファイルにエクスポートします

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
csvPathYesCSVファイルの出力パス
filePathYesExcelファイルのパス(既存ファイル)
sheetNameYesワークシート名(既存シート)

Implementation Reference

  • The core handler function that loads the Excel workbook, retrieves the specified worksheet, and exports it to a CSV file using ExcelJS.
    async function exportToCSV(filePath: string, sheetName: string, csvPath: string): Promise<string> {
      try {
        const workbook = await loadWorkbook(filePath);
        const worksheet = workbook.getWorksheet(sheetName);
        if (!worksheet) {
          throw new Error(`ワークシート '${sheetName}' が見つかりません。`);
        }
        
        await workbook.csv.writeFile(csvPath, { sheetName });
        return `ワークシート '${sheetName}' をCSVファイル '${csvPath}' にエクスポートしました。`;
      } catch (error) {
        throw new McpError(ErrorCode.InternalError, `CSV出力エラー: ${error}`);
      }
    }
  • Zod schema defining the input parameters for the export_to_csv tool: filePath, sheetName, and csvPath.
    const ExportToCSVSchema = z.object({
      filePath: z.string().describe("Excelファイルのパス(既存ファイル)"),
      sheetName: z.string().describe("ワークシート名(既存シート)"),
      csvPath: z.string().describe("CSVファイルの出力パス"),
    });
  • src/index.ts:517-520 (registration)
    Registration of the export_to_csv tool in the ListTools response, including name, description, and input schema.
      name: "export_to_csv",
      description: "ワークシートをCSVファイルにエクスポートします",
      inputSchema: zodToJsonSchema(ExportToCSVSchema)
    }
  • src/index.ts:567-570 (registration)
    The tool handler registration in the toolImplementations map, which parses args with the schema and delegates to the exportToCSV function.
    export_to_csv: async (args: any) => {
      const { filePath, sheetName, csvPath } = ExportToCSVSchema.parse(args);
      return await exportToCSV(filePath, sheetName, csvPath);
    }
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 states the export action but doesn't describe traits like whether it overwrites existing CSV files, requires specific file permissions, handles errors, or returns any output (e.g., success confirmation or file path). This leaves significant gaps for a mutation tool that creates files.

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 in Japanese that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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 has 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain behavioral aspects like file handling, error cases, or what happens post-export (e.g., if it returns a confirmation). For a tool that performs file operations, this lack of context is a significant gap.

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 schema description coverage is 100%, with clear parameter descriptions in Japanese (e.g., 'CSVファイルの出力パス' for csvPath). The description adds no additional parameter meaning beyond the schema, so it meets the baseline of 3 where the schema does the heavy lifting without compensating for gaps.

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 action ('エクスポートします' - exports) and resource ('ワークシートをCSVファイルに' - worksheet to CSV file), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_range_values' or 'get_workbook_info' that might also retrieve data, though those don't explicitly export to CSV.

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 an existing Excel file), exclusions, or compare to siblings like 'get_range_values' for data retrieval without export. The description is standalone with no contextual usage hints.

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/SuperPyonchiX/excel_mcp_server'

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