Skip to main content
Glama

sheets_insert_sheet

Add a new sheet to a Google Sheets spreadsheet by specifying its title, position, and dimensions. Requires the spreadsheet ID for integration.

Instructions

Add a new sheet to an existing Google Sheets spreadsheet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnCountNoNumber of columns in the sheet (default: 26)
indexNoThe index where the sheet should be inserted (0-based)
rowCountNoNumber of rows in the sheet (default: 1000)
spreadsheetIdYesThe ID of the spreadsheet (found in the URL after /d/)
titleYesThe title of the new sheet

Implementation Reference

  • The handler function that validates input, authenticates with Google Sheets API, performs batchUpdate to add a new sheet, and formats the response.
    export async function handleInsertSheet(input: any) {
      try {
        const validatedInput = validateInsertSheetInput(input);
        const sheets = await getAuthenticatedClient();
    
        const response = await sheets.spreadsheets.batchUpdate({
          spreadsheetId: validatedInput.spreadsheetId,
          requestBody: {
            requests: [
              {
                addSheet: {
                  properties: {
                    title: validatedInput.title,
                    index: validatedInput.index,
                    gridProperties: {
                      rowCount: validatedInput.rowCount,
                      columnCount: validatedInput.columnCount,
                    },
                  },
                },
              },
            ],
          },
        });
    
        const addedSheet = response.data.replies?.[0]?.addSheet
          ? response.data.replies[0].addSheet.properties
          : undefined;
        return formatSheetOperationResponse('Sheet inserted', {
          sheetId: addedSheet ? addedSheet.sheetId : undefined,
          title: addedSheet ? addedSheet.title : undefined,
          index: addedSheet ? addedSheet.index : undefined,
        });
      } catch (error) {
        return handleError(error);
      }
    }
  • Tool definition with name, description, and input schema specifying required spreadsheetId and title, optional index, rowCount, columnCount.
    export const insertSheetTool: Tool = {
      name: 'sheets_insert_sheet',
      description: 'Add a new sheet to an existing Google Sheets spreadsheet',
      inputSchema: {
        type: 'object',
        properties: {
          spreadsheetId: {
            type: 'string',
            description: 'The ID of the spreadsheet (found in the URL after /d/)',
          },
          title: {
            type: 'string',
            description: 'The title of the new sheet',
          },
          index: {
            type: 'number',
            description: 'The index where the sheet should be inserted (0-based)',
          },
          rowCount: {
            type: 'number',
            description: 'Number of rows in the sheet (default: 1000)',
          },
          columnCount: {
            type: 'number',
            description: 'Number of columns in the sheet (default: 26)',
          },
        },
        required: ['spreadsheetId', 'title'],
      },
    };
  • src/index.ts:42-42 (registration)
    Registers the handler for 'sheets_insert_sheet' in the toolHandlers Map used to dispatch CallToolRequests.
    ['sheets_insert_sheet', tools.handleInsertSheet],
  • src/index.ts:77-77 (registration)
    Includes the tool schema in the allTools array for ListToolsRequest response.
    tools.insertSheetTool,
  • Re-exports the tool definition and handler from the insert-sheet module for use in src/index.ts.
    export * from './insert-sheet.js';
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 'Add a new sheet' implies a write/mutation operation, it doesn't address permission requirements, whether the operation is reversible (e.g., can the sheet be deleted), rate limits, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap.

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 directly states the tool's purpose with zero wasted words. It's appropriately sized and front-loaded, making it easy for an agent to quickly understand what the tool does.

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 mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after the sheet is added (e.g., what's returned, how to reference the new sheet), doesn't address error conditions, and provides no behavioral context beyond the basic action. More detail is needed given the tool's complexity and lack of structured metadata.

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 all 5 parameters. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain relationships between parameters or provide usage examples). Baseline 3 is appropriate when the schema does all the parameter documentation work.

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 ('Add a new sheet') and target resource ('to an existing Google Sheets spreadsheet'), providing specific verb+resource. However, it doesn't explicitly differentiate from sibling tools like 'sheets_create_spreadsheet' (which creates a whole new spreadsheet) or 'sheets_duplicate_sheet' (which copies an existing sheet), missing full sibling distinction.

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. It doesn't mention when to choose this over 'sheets_create_spreadsheet' (for new spreadsheets) or 'sheets_duplicate_sheet' (for copying existing sheets), nor does it specify any prerequisites or exclusions for usage.

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