Skip to main content
Glama

sheets_create_spreadsheet

Create a new Google Sheets spreadsheet with customizable titles, sheet configurations, and predefined rows and columns through the mcp-gsheets server.

Instructions

Create a new Google Sheets spreadsheet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sheetsNoArray of sheets to create in the spreadsheet
titleYesThe title of the new spreadsheet

Implementation Reference

  • The main handler function that executes the tool logic: validates input, gets authenticated Sheets client, builds request body with title and optional sheets config, creates the spreadsheet via API, formats and returns response, handles errors.
    export async function handleCreateSpreadsheet(input: any) {
      try {
        const validatedInput = validateCreateSpreadsheetInput(input);
        const sheets = await getAuthenticatedClient();
    
        const requestBody: any = {
          properties: {
            title: validatedInput.title,
          },
        };
    
        if (validatedInput.sheets && validatedInput.sheets.length > 0) {
          requestBody.sheets = validatedInput.sheets.map((sheet, index) => ({
            properties: {
              title: sheet.title || `Sheet${index + 1}`,
              gridProperties: {
                rowCount: sheet.rowCount || 1000,
                columnCount: sheet.columnCount || 26,
              },
            },
          }));
        }
    
        const response = await sheets.spreadsheets.create({
          requestBody,
        });
    
        return formatSpreadsheetCreatedResponse(response.data);
      } catch (error) {
        return handleError(error);
      }
    }
  • The Tool definition object with name, description, and detailed inputSchema for validating the tool parameters.
    export const createSpreadsheetTool: Tool = {
      name: 'sheets_create_spreadsheet',
      description: 'Create a new Google Sheets spreadsheet',
      inputSchema: {
        type: 'object',
        properties: {
          title: {
            type: 'string',
            description: 'The title of the new spreadsheet',
          },
          sheets: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                title: {
                  type: 'string',
                  description: 'The title of the sheet',
                },
                rowCount: {
                  type: 'number',
                  description: 'Number of rows in the sheet (default: 1000)',
                },
                columnCount: {
                  type: 'number',
                  description: 'Number of columns in the sheet (default: 26)',
                },
              },
            },
            description: 'Array of sheets to create in the spreadsheet',
          },
        },
        required: ['title'],
      },
    };
  • src/index.ts:32-64 (registration)
    The toolHandlers Map registration that maps the tool name 'sheets_create_spreadsheet' to its handler function tools.handleCreateSpreadsheet for execution dispatch.
    const toolHandlers = new Map<string, (input: any) => Promise<any>>([
      ['sheets_check_access', tools.handleCheckAccess],
      ['sheets_get_values', tools.handleGetValues],
      ['sheets_batch_get_values', tools.handleBatchGetValues],
      ['sheets_get_metadata', tools.handleGetMetadata],
      ['sheets_update_values', tools.handleUpdateValues],
      ['sheets_batch_update_values', tools.handleBatchUpdateValues],
      ['sheets_append_values', tools.handleAppendValues],
      ['sheets_clear_values', tools.handleClearValues],
      ['sheets_create_spreadsheet', tools.handleCreateSpreadsheet],
      ['sheets_insert_sheet', tools.handleInsertSheet],
      ['sheets_delete_sheet', tools.handleDeleteSheet],
      ['sheets_duplicate_sheet', tools.handleDuplicateSheet],
      ['sheets_copy_to', tools.handleCopyTo],
      ['sheets_update_sheet_properties', tools.handleUpdateSheetProperties],
      ['sheets_format_cells', tools.formatCellsHandler],
      ['sheets_update_borders', tools.updateBordersHandler],
      ['sheets_merge_cells', tools.mergeCellsHandler],
      ['sheets_unmerge_cells', tools.unmergeCellsHandler],
      ['sheets_add_conditional_formatting', tools.addConditionalFormattingHandler],
      // Batch operations
      ['sheets_batch_delete_sheets', tools.handleBatchDeleteSheets],
      ['sheets_batch_format_cells', tools.handleBatchFormatCells],
      // Chart operations
      ['sheets_create_chart', tools.handleCreateChart],
      ['sheets_update_chart', tools.handleUpdateChart],
      ['sheets_delete_chart', tools.handleDeleteChart],
      // Link and date operations
      ['sheets_insert_link', tools.handleInsertLink],
      ['sheets_insert_date', tools.handleInsertDate],
      // Row operations
      ['sheets_insert_rows', tools.handleInsertRows],
    ]);
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. 'Create' implies a write/mutation operation, but the description doesn't mention authentication requirements, permission levels needed, whether this creates files in a specific location (like the user's Google Drive root), rate limits, or what happens on success/failure. For a creation tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 states exactly what the tool does without any wasted words. It's front-loaded with the core functionality and contains no unnecessary information. Every word earns its place in this minimal but complete statement of purpose.

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?

For a creation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., spreadsheet ID, URL, metadata), doesn't mention error conditions, and provides no context about how the created spreadsheet integrates with the broader Google Sheets/Drive ecosystem. The agent would need to guess about important aspects of using this tool effectively.

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 input schema has 100% description coverage, providing complete documentation for both parameters (title and sheets array with nested properties). The description adds no parameter information beyond what's already in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 Google Sheets spreadsheet'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its siblings (like sheets_insert_sheet or sheets_copy_to), which also create spreadsheet elements. The description is specific about what's being created but lacks differentiation from related tools.

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 sheets_copy_to (which creates a copy of an existing spreadsheet) and sheets_insert_sheet (which adds sheets to an existing spreadsheet), the agent receives no help in choosing between creation tools. There's no mention of prerequisites, constraints, or typical use cases.

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/freema/mcp-gsheets'

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