Skip to main content
Glama

create_worksheet

Add a new worksheet to an Excel workbook by specifying the file path and sheet name. Streamline workbook organization and data management with this tool on the Excel MCP Server.

Instructions

Create new worksheet in workbook.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes
sheet_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'create_worksheet'. Resolves the full file path using get_excel_path, imports and calls the create_sheet helper from workbook module, handles errors, and returns the result message.
    @mcp.tool()
    def create_worksheet(filepath: str, sheet_name: str) -> str:
        """Create new worksheet in workbook."""
        try:
            full_path = get_excel_path(filepath)
            from excel_mcp.workbook import create_sheet as create_worksheet_impl
            result = create_worksheet_impl(full_path, sheet_name)
            return result["message"]
        except (ValidationError, WorkbookError) as e:
            return f"Error: {str(e)}"
        except Exception as e:
            logger.error(f"Error creating worksheet: {e}")
            raise
  • Core helper function implementing the worksheet creation logic using openpyxl. Loads the workbook, checks if the sheet already exists, creates a new sheet if not, saves the workbook, and returns a success message.
    def create_sheet(filepath: str, sheet_name: str) -> dict:
        """Create a new worksheet in the workbook if it doesn't exist."""
        try:
            wb = load_workbook(filepath)
    
            # Check if sheet already exists
            if sheet_name in wb.sheetnames:
                raise WorkbookError(f"Sheet {sheet_name} already exists")
    
            # Create new sheet
            wb.create_sheet(sheet_name)
            wb.save(filepath)
            wb.close()
            return {"message": f"Sheet {sheet_name} created successfully"}
        except WorkbookError as e:
            logger.error(str(e))
            raise
        except Exception as e:
            logger.error(f"Failed to create sheet: {e}")
            raise WorkbookError(str(e))
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Create new worksheet' implies a write/mutation operation, but the description doesn't mention permissions needed, whether it overwrites existing worksheets, error conditions, or what happens on success. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 at 5 words, front-loading the essential action and resource. Every word earns its place with zero waste or redundancy, making it immediately scannable and understandable.

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?

Given that there's an output schema (which should document return values), the description doesn't need to explain outputs. However, for a mutation tool with no annotations and siblings that perform related operations, the description is minimally adequate—it states what the tool does but lacks context about how it behaves, when to use it, or how it differs from alternatives.

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 0% schema description coverage, the description provides no information about the two required parameters (filepath and sheet_name). However, since there are only 2 parameters and their names are self-explanatory (filepath likely points to an Excel file, sheet_name is the name for the new worksheet), the baseline of 3 is appropriate—the description doesn't add value but doesn't need to compensate heavily for simple parameters.

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 ('Create') and resource ('new worksheet in workbook'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_workbook' or 'rename_worksheet', which would require more specific context about what distinguishes this creation operation.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'create_workbook' (for creating entire workbooks) and 'rename_worksheet' (for modifying existing worksheets), there's no indication of prerequisites, appropriate contexts, or exclusions for this worksheet creation tool.

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/haris-musa/excel-mcp-server'

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