Skip to main content
Glama

get_sheet_info

Retrieve spreadsheet metadata including sheet names, properties, and basic structure to understand document organization and contents.

Instructions

スプレッドシートの基本情報を取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spreadsheetIdYesスプレッドシートのID

Implementation Reference

  • The main handler function that implements the get_sheet_info tool logic. It uses the Google Sheets API to fetch the spreadsheet metadata, extracts sheet information, and returns it as JSON.
    async function getSheetInfo(spreadsheetId: string) {
      const authClient = await auth.getClient();
      const sheets = google.sheets({ version: "v4", auth: authClient as any });
    
      const response = await sheets.spreadsheets.get({
        spreadsheetId,
      });
    
      const sheetsInfo = response.data.sheets?.map((sheet) => ({
        title: sheet.properties?.title,
        sheetId: sheet.properties?.sheetId,
        rowCount: sheet.properties?.gridProperties?.rowCount,
        columnCount: sheet.properties?.gridProperties?.columnCount,
      }));
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                title: response.data.properties?.title,
                sheets: sheetsInfo,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Input schema definition for the get_sheet_info tool, specifying the required spreadsheetId parameter.
    inputSchema: {
      type: "object",
      properties: {
        spreadsheetId: {
          type: "string",
          description: "スプレッドシートのID",
        },
      },
      required: ["spreadsheetId"],
    },
  • src/index.ts:109-122 (registration)
    Registration of the get_sheet_info tool in the tools array used for ListToolsRequestHandler.
    {
      name: "get_sheet_info",
      description: "スプレッドシートの基本情報を取得します",
      inputSchema: {
        type: "object",
        properties: {
          spreadsheetId: {
            type: "string",
            description: "スプレッドシートのID",
          },
        },
        required: ["spreadsheetId"],
      },
    },
  • src/index.ts:177-178 (registration)
    Tool dispatch case in the CallToolRequestHandler that invokes the getSheetInfo handler.
    case "get_sheet_info":
      return await getSheetInfo(args.spreadsheetId as string);

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