Skip to main content
Glama

get_cell_value

Retrieve specific cell values from an Excel file by providing the file path, sheet name, and cell location in A1 format.

Instructions

指定されたセルの値を取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cellYesセル位置。A1形式で指定(例: A1, B2, AA10)
filePathYes対象のExcelファイルの絶対パス
sheetNameYes対象のワークシート名

Implementation Reference

  • Core handler function that validates the cell address, loads the Excel workbook using loadWorkbook, retrieves the specified worksheet, gets the cell value using ExcelJS, and returns the formatted result or throws an MCP error on failure.
    async function getCellValue(filePath: string, sheetName: string, cell: string): Promise<string> {
      try {
        validateCellAddress(cell);
        
        const workbook = await loadWorkbook(filePath);
        const worksheet = workbook.getWorksheet(sheetName);
        if (!worksheet) {
          throw new Error(`ワークシート '${sheetName}' が見つかりません。利用可能なシート: ${getSheetNames(workbook)}`);
        }
        const cellValue = worksheet.getCell(cell).value;
        return `セル ${cell} の値: ${cellValue}`;
      } catch (error) {
        throw new McpError(ErrorCode.InternalError, `セル値取得エラー: ${error}`);
      }
    }
  • Zod schema defining the input parameters for the get_cell_value tool: filePath (absolute path to Excel file), sheetName, and cell (A1-style address). Used for validation in tool calls.
    const GetCellValueSchema = z.object({
      filePath: z.string().describe("対象のExcelファイルの絶対パス"),
      sheetName: z.string().describe("対象のワークシート名"),
      cell: z.string().describe("セル位置。A1形式で指定(例: A1, B2, AA10)"),
    });
  • src/index.ts:487-490 (registration)
    Tool registration in the ListToolsRequestSchema handler, specifying name, description, and inputSchema for discovery by MCP clients.
      name: "get_cell_value",
      description: "指定されたセルの値を取得します", 
      inputSchema: zodToJsonSchema(GetCellValueSchema)
    },
  • MCP tool dispatcher wrapper that parses input arguments using the schema and delegates to the core getCellValue handler function.
    get_cell_value: async (args: any) => {
      const { filePath, sheetName, cell } = GetCellValueSchema.parse(args);
      return await getCellValue(filePath, sheetName, cell);
    },
  • Helper function to validate the cell address format using regex (A-Z+ followed by digits starting from 1), throws error on invalid format. Called by getCellValue.
    function validateCellAddress(cell: string): void {
      const cellPattern = /^[A-Z]+[1-9]\d*$/;
      if (!cellPattern.test(cell)) {
        throw new Error(`無効なセル位置: '${cell}'。正しい形式: A1, B2, AA10など`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves a cell value, implying a read-only operation, but doesn't cover critical aspects like error handling (e.g., what happens if the file doesn't exist), performance (e.g., speed or limitations), or output format (e.g., data type returned). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 extremely concise and front-loaded: a single sentence that directly states the tool's purpose. There is zero waste or redundancy, making it easy to parse quickly. This efficiency is ideal for a simple tool, though it may lack depth for more complex scenarios.

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?

Given the tool's complexity (3 required parameters, no output schema, and no annotations), the description is incomplete. It doesn't explain the return value (e.g., what data type is returned, such as string or number), error conditions, or how it interacts with sibling tools. For a read operation in a spreadsheet context, more detail on behavior and output would be necessary for an agent to use it effectively.

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 description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage, with clear explanations for 'cell' (cell position in A1 format), 'filePath' (absolute path to Excel file), and 'sheetName' (worksheet name). Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate with additional context like examples or constraints.

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 tool's purpose: '指定されたセルの値を取得します' (Get the value of the specified cell). It uses a specific verb ('取得します' - get/retrieve) and resource ('セルの値' - cell value), making the action clear. However, it doesn't explicitly differentiate from sibling tools like 'get_range_values' or 'set_cell_value', which would require more specific language about scope or operation type.

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. It doesn't mention sibling tools like 'get_range_values' (for multiple cells) or 'set_cell_value' (for writing), nor does it specify prerequisites such as needing an existing Excel file. Without this context, an agent might struggle to choose between similar tools.

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

Related 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/SuperPyonchiX/excel_mcp_server'

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