get_sheet_info
Retrieve basic information about a Google Spreadsheet using its ID, including sheet details and metadata.
Instructions
スプレッドシートの基本情報を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spreadsheetId | Yes | スプレッドシートのID |
Implementation Reference
- src/index.ts:276-306 (handler)The handler function `getSheetInfo` that fetches spreadsheet metadata including title and list of sheets with their properties using Google Sheets API v4.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 ), }, ], }; }
- src/index.ts:109-122 (registration)Tool registration in the `tools` array used by ListToolsRequestHandler, defining name, description, and input schema.{ name: "get_sheet_info", description: "スプレッドシートの基本情報を取得します", inputSchema: { type: "object", properties: { spreadsheetId: { type: "string", description: "スプレッドシートのID", }, }, required: ["spreadsheetId"], }, },
- src/index.ts:177-178 (registration)Dispatch case in the CallToolRequestHandler switch statement that invokes the getSheetInfo handler.case "get_sheet_info": return await getSheetInfo(args.spreadsheetId as string);
- src/index.ts:112-121 (schema)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"], },