get_cell
Retrieve the value from a specific cell in Excel or CSV files using A1 notation. Specify file path and cell address to extract data for analysis.
Instructions
Get the value of a specific cell using A1 notation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to the CSV or Excel file | |
| cell | Yes | Cell address in A1 notation (e.g., "A1", "B5") | |
| sheet | No | Sheet name for Excel files (optional) |
Implementation Reference
- src/handlers/data-operations.ts:100-162 (handler)The handler function that executes the get_cell tool. It reads the specified file/sheet, parses the A1 cell notation, validates bounds, retrieves the cell value, and returns it in a standardized ToolResponse format.async getCell(args: ToolArgs): Promise<ToolResponse> { try { const { filePath, cell, sheet } = args; const data = await readFileContent(filePath, sheet); if (!cell || typeof cell !== 'string') { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: 'Invalid cell reference', }, null, 2), }, ], }; } const { row, col } = parseA1Notation(cell); if (row >= data.length || col >= (data[0]?.length || 0)) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: `Cell ${cell} is out of range`, }, null, 2), }, ], }; } const value = data[row][col]; return { content: [ { type: 'text', text: JSON.stringify({ success: true, cellValue: value, cellAddress: cell, }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', }, null, 2), }, ], }; } }
- src/index.ts:98-118 (schema)The input schema definition and tool metadata (name, description) for the get_cell tool, registered in the ListTools response.name: 'get_cell', description: 'Get the value of a specific cell using A1 notation', inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: 'Path to the CSV or Excel file', }, cell: { type: 'string', description: 'Cell address in A1 notation (e.g., "A1", "B5")', }, sheet: { type: 'string', description: 'Sheet name for Excel files (optional)', }, }, required: ['filePath', 'cell'], }, },
- src/index.ts:1202-1202 (registration)The dispatch registration in the CallToolRequestSchema handler that routes calls to the getCell method on the DataOperationsHandler instance.return await this.dataOpsHandler.getCell(toolArgs);