Skip to main content
Glama

create_workbook

Generate an empty Excel workbook file at a specified file path. Use this tool to initialize a workbook before adding worksheets with the add_worksheet tool for data manipulation.

Instructions

新しいExcelワークブックを作成します。注意: 作成されるワークブックは空でシートを含みません。データを操作する前にadd_worksheetツールでワークシートを追加する必要があります。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYes作成するExcelファイルの絶対パス。例: C:/Users/Username/Documents/report.xlsx。ファイル拡張子は.xlsxである必要があります。注意: 作成されるワークブックは空でシートを含みません

Implementation Reference

  • The core handler function that creates an empty Excel workbook (.xlsx) at the specified absolute file path using ExcelJS library. Validates the path and returns a success message.
    async function createWorkbook(filePath: string): Promise<string> {
      try {
        validateFilePath(filePath);
        
        // 空のワークブックを作成(シートは含まれない)
        const workbook = new ExcelJS.Workbook();
        await workbook.xlsx.writeFile(filePath);
        
        return `Excelワークブック '${filePath}' を作成しました。注意: このワークブックはシートを含んでいません。データを操作する前に、add_worksheetツールを使用してワークシートを追加してください。`;
      } catch (error) {
        throw new McpError(ErrorCode.InternalError, `ワークブック作成エラー: ${error}`);
      }
    }
  • Zod schema defining the input for create_workbook tool: requires 'filePath' as a string with description.
    const CreateWorkbookSchema = z.object({
      filePath: z.string().describe("作成するExcelファイルの絶対パス。例: C:/Users/Username/Documents/report.xlsx。ファイル拡張子は.xlsxである必要があります。注意: 作成されるワークブックは空でシートを含みません"),
    });
  • src/index.ts:466-470 (registration)
    Tool registration in the ListTools response: defines name, description, and input schema.
    {
      name: "create_workbook",
      description: "新しいExcelワークブックを作成します。注意: 作成されるワークブックは空でシートを含みません。データを操作する前にadd_worksheetツールでワークシートを追加する必要があります。",
      inputSchema: zodToJsonSchema(CreateWorkbookSchema)
    },
  • src/index.ts:527-530 (registration)
    Tool implementation registration in the toolImplementations map used by CallToolRequestSchema handler: parses args with schema and delegates to createWorkbook function.
    create_workbook: async (args: any) => {
      const { filePath } = CreateWorkbookSchema.parse(args);
      return await createWorkbook(filePath);
    },
  • Helper function to validate the filePath input: checks non-empty, .xlsx/.xls extension, and absolute path.
    function validateFilePath(filePath: string): void {
      if (!filePath) {
        throw new Error("ファイルパスが指定されていません");
      }
      if (!filePath.endsWith('.xlsx') && !filePath.endsWith('.xls')) {
        throw new Error("ファイル拡張子は .xlsx または .xls である必要があります");
      }
      if (!path.isAbsolute(filePath)) {
        throw new Error("絶対パスを指定してください(例: C:/Users/Username/Documents/file.xlsx)");
      }
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing critical behavioral traits: the workbook is created empty without sheets, and users must use add_worksheet tool before data manipulation. This provides important context about the tool's limitations and required follow-up actions.

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 states the core purpose, the second provides crucial behavioral context. No wasted words, front-loaded with the main action.

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

Completeness4/5

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

For a creation tool with no annotations and no output schema, the description does well by explaining the workbook's empty state and required next steps. However, it doesn't mention what happens if the file already exists at the path, or what the tool returns (success/failure indication), leaving some gaps in completeness.

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 already fully documents the single filePath parameter. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 when schema does the heavy lifting.

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 specific action ('新しいExcelワークブックを作成します' - creates a new Excel workbook) and resource (Excel workbook), distinguishing it from siblings like add_worksheet or get_workbook_info by focusing on creation rather than modification or retrieval.

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 about when to use this tool (to create a new Excel workbook) and includes important behavioral notes about the workbook being empty without sheets, but doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools.

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