get_sheet_info
Retrieve spreadsheet metadata including sheet names, properties, and basic structure to understand document organization and contents.
Instructions
スプレッドシートの基本情報を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spreadsheetId | Yes | スプレッドシートのID |
Implementation Reference
- src/index.ts:276-306 (handler)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 ), }, ], }; }
- 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"], },
- 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);