Skip to main content
Glama

write_sheet

Write data to specified ranges in Google Sheets. Use this tool to update spreadsheet cells with new values programmatically.

Instructions

スプレッドシートの指定された範囲にデータを書き込みます

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spreadsheetIdYesスプレッドシートのID
rangeYes書き込む範囲(例: 'Sheet1!A1:C10')
valuesYes書き込むデータ(2次元配列)

Implementation Reference

  • The handler function that executes the write_sheet tool logic, using Google Sheets API to update values in the specified range.
    async function writeSheet(
      spreadsheetId: string,
      range: string,
      values: string[][]
    ) {
      const authClient = await auth.getClient();
      const sheets = google.sheets({ version: "v4", auth: authClient as any });
    
      const response = await sheets.spreadsheets.values.update({
        spreadsheetId,
        range,
        valueInputOption: "RAW",
        requestBody: {
          values,
        },
      });
    
      return {
        content: [
          {
            type: "text",
            text: `データが正常に書き込まれました。更新されたセル数: ${response.data.updatedCells}`,
          },
        ],
      };
    }
  • The input schema defining parameters for the write_sheet tool: spreadsheetId, range, and values (2D array).
    inputSchema: {
      type: "object",
      properties: {
        spreadsheetId: {
          type: "string",
          description: "スプレッドシートのID",
        },
        range: {
          type: "string",
          description: "書き込む範囲(例: 'Sheet1!A1:C10')",
        },
        values: {
          type: "array",
          items: {
            type: "array",
            items: {
              type: "string",
            },
          },
          description: "書き込むデータ(2次元配列)",
        },
      },
      required: ["spreadsheetId", "range", "values"],
    },
  • src/index.ts:163-168 (registration)
    The switch case in the CallToolRequestSchema handler that registers and dispatches to the writeSheet function for write_sheet tool calls.
    case "write_sheet":
      return await writeSheet(
        args.spreadsheetId as string,
        args.range as string,
        args.values as string[][]
      );
  • src/index.ts:56-83 (registration)
    The tool definition object in the tools array used for ListToolsRequestSchema, registering the write_sheet tool's name, description, and schema.
    {
      name: "write_sheet",
      description: "スプレッドシートの指定された範囲にデータを書き込みます",
      inputSchema: {
        type: "object",
        properties: {
          spreadsheetId: {
            type: "string",
            description: "スプレッドシートのID",
          },
          range: {
            type: "string",
            description: "書き込む範囲(例: 'Sheet1!A1:C10')",
          },
          values: {
            type: "array",
            items: {
              type: "array",
              items: {
                type: "string",
              },
            },
            description: "書き込むデータ(2次元配列)",
          },
        },
        required: ["spreadsheetId", "range", "values"],
      },
    },
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 tool writes data to a spreadsheet range, implying a mutation operation, but doesn't specify whether this overwrites existing data, requires specific permissions, or has side effects like formatting changes. This is a significant gap for a write tool with zero annotation coverage.

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 function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 write operation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., overwrite behavior, error conditions), usage context compared to siblings, and expected outcomes. This leaves the agent poorly equipped to use the tool effectively in complex scenarios.

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 descriptions for all three parameters (spreadsheetId, range, values). The description adds no additional meaning beyond what the schema provides, such as explaining the format of 'values' or constraints on 'range'. Given the high schema coverage, a baseline score of 3 is appropriate.

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 ('書き込みます' - writes) and resource ('スプレッドシートの指定された範囲' - specified range of spreadsheet), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like 'append_row' or 'create_sheet', which is why it doesn't reach a 5.

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 like 'append_row' (which might add data without overwriting) or 'create_sheet' (which creates new sheets). There's no mention of prerequisites, such as needing an existing spreadsheet, or exclusions, leaving the agent with little context for tool selection.

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

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/Kyohei-9841/google-spreadsheet-MCP'

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