Skip to main content
Glama

find_data

Locate specific values within Excel worksheets by specifying file path, sheet name, and search value to streamline data retrieval.

Instructions

ワークシート内で指定された値を検索します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesExcelファイルのパス
searchValueYes検索する値
sheetNameYesワークシート名

Implementation Reference

  • The main handler function that loads the Excel workbook, iterates through rows and cells in the specified sheet to find exact matches for the searchValue, and returns a string listing the matching cell addresses.
    async function findData(filePath: string, sheetName: string, searchValue: any): Promise<string> { try { const workbook = await loadWorkbook(filePath); const worksheet = workbook.getWorksheet(sheetName); if (!worksheet) { throw new Error(`ワークシート '${sheetName}' が見つかりません。`); } const results: string[] = []; worksheet.eachRow((row, rowNumber) => { row.eachCell((cell, colNumber) => { if (cell.value === searchValue) { const cellAddress = worksheet.getCell(rowNumber, colNumber).address; results.push(cellAddress); } }); }); return `値 '${searchValue}' が見つかったセル: ${results.join(', ')}`; } catch (error) { throw new McpError(ErrorCode.InternalError, `データ検索エラー: ${error}`); } }
  • Zod schema defining the input parameters for the find_data tool: filePath (string), sheetName (string), searchValue (string or number).
    const FindDataSchema = z.object({ filePath: z.string().describe("Excelファイルのパス"), sheetName: z.string().describe("ワークシート名"), searchValue: z.union([z.string(), z.number()]).describe("検索する値"), });
  • src/index.ts:563-566 (registration)
    Tool implementation wrapper in the toolImplementations map that parses input arguments using FindDataSchema and delegates to the findData handler function. This is invoked by the CallToolRequestSchema handler.
    find_data: async (args: any) => { const { filePath, sheetName, searchValue } = FindDataSchema.parse(args); return await findData(filePath, sheetName, searchValue); },
  • src/index.ts:511-515 (registration)
    Registration of the find_data tool in the ListToolsRequestSchema response, providing name, description, and input schema for tool discovery.
    { name: "find_data", description: "ワークシート内で指定された値を検索します", inputSchema: zodToJsonSchema(FindDataSchema) },

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