Skip to main content
Glama
ishayoyo

Excel MCP Server

by ishayoyo

vlookup_helper

Perform VLOOKUP operations in Excel with intelligent error handling and fuzzy matching capabilities to retrieve data from lookup tables.

Instructions

Intelligent VLOOKUP setup and execution with error handling and fuzzy matching

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceFileYesFile with data that needs lookup values
lookupFileYesFile to lookup values from
lookupColumnYesColumn name or index to match on
returnColumnsNoColumns to return from lookup table (empty = all except lookup column)
fuzzyMatchNoEnable fuzzy string matching for lookups (default: false)
handleErrorsNoAuto-handle #N/A errors with fallbacks (default: true)
sourceSheetNoSheet name for source Excel file (optional)
lookupSheetNoSheet name for lookup Excel file (optional)

Implementation Reference

  • The primary handler function for the 'vlookup_helper' MCP tool. It reads data from source and lookup files, identifies columns, builds a lookup map for efficient querying, and returns a summary with preview data. Supports fuzzy matching and error handling options. Note: actual source data lookup and match counts are placeholders in this implementation.
    async vlookupHelper(args: ToolArgs): Promise<ToolResponse> {
      try {
        const {
          sourceFile,
          lookupFile,
          lookupColumn,
          returnColumns = [],
          fuzzyMatch = false,
          handleErrors = true,
          sourceSheet,
          lookupSheet
        } = args;
    
        if (!sourceFile || !lookupFile || !lookupColumn) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: 'Missing required parameters: sourceFile, lookupFile, lookupColumn'
              }, null, 2)
            }]
          };
        }
    
        // Read both files
        const sourceData = await readFileContent(sourceFile, sourceSheet);
        const lookupData = await readFileContent(lookupFile, lookupSheet);
    
        if (sourceData.length === 0 || lookupData.length === 0) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: 'One or both files are empty'
              }, null, 2)
            }]
          };
        }
    
        const sourceHeaders = sourceData[0];
        const lookupHeaders = lookupData[0];
        const lookupRows = lookupData.slice(1);
    
        // Find lookup column index
        let lookupColIndex = typeof lookupColumn === 'number' ? lookupColumn : lookupHeaders.indexOf(lookupColumn);
        if (lookupColIndex === -1) {
          throw new Error(`Lookup column "${lookupColumn}" not found`);
        }
    
        // Find return column indices
        let returnColIndices: number[] = [];
        if (returnColumns.length === 0) {
          // Return all columns except lookup column
          returnColIndices = Array.from({length: lookupHeaders.length}, (_, i) => i)
            .filter(i => i !== lookupColIndex);
        } else {
          returnColIndices = returnColumns.map((col: any) => {
            if (typeof col === 'number') return col;
            const index = lookupHeaders.indexOf(col);
            if (index === -1) throw new Error(`Return column "${col}" not found`);
            return index;
          });
        }
    
        // Create lookup map
        const lookupMap = new Map<string, any[]>();
        lookupRows.forEach((row: any[]) => {
          const key = String(row[lookupColIndex] || '').toLowerCase();
          const values = returnColIndices.map((i: number) => row[i]);
          lookupMap.set(key, values);
        });
    
        const result = {
          success: true,
          operation: 'vlookup_helper',
          summary: {
            sourceRows: sourceData.length - 1,
            lookupRows: lookupRows.length,
            lookupColumn: lookupHeaders[lookupColIndex],
            returnColumns: returnColIndices.map((i: number) => lookupHeaders[i]),
            fuzzyMatch,
            handleErrors
          },
          lookupMap: Object.fromEntries(Array.from(lookupMap.entries()).slice(0, 10)), // Preview
          matchedCount: 0, // Would be calculated during actual lookup
          unmatchedCount: 0 // Would be calculated during actual lookup
        };
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }]
        };
    
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: false,
              error: error instanceof Error ? error.message : 'Unknown error',
              operation: 'vlookup_helper'
            }, null, 2)
          }]
        };
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'error handling and fuzzy matching' but doesn't specify what errors are handled, what fallbacks are used, how fuzzy matching works, or any performance characteristics. For a tool with 8 parameters and no annotations, this leaves significant behavioral gaps.

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 a single, efficient phrase that packs key information: the core function (VLOOKUP), setup/execution scope, and two main features. Every word earns its place with no redundancy or wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 parameters, no annotations, and no output schema, the description is moderately complete. It identifies the tool's domain and key features but lacks details on behavior, output format, and usage context. Given the complexity, it should provide more guidance on what the tool returns and how it differs from alternatives.

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 schema description coverage is 100%, so all parameters are documented in the schema. The description adds minimal value beyond the schema by mentioning 'fuzzy matching' and 'error handling' which correspond to parameters, but doesn't provide additional semantic context. This meets the baseline for high schema coverage.

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 as 'Intelligent VLOOKUP setup and execution with error handling and fuzzy matching', which specifies the verb (VLOOKUP setup/execution) and key capabilities. However, it doesn't explicitly differentiate from sibling tools like 'search' or 'find_duplicates' that might also perform lookups, keeping it from a perfect score.

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. With many sibling tools like 'search', 'find_duplicates', and 'smart_data_analysis' that might handle similar tasks, there's no indication of specific contexts, prerequisites, or exclusions for this VLOOKUP tool.

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

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/ishayoyo/excel-mcp'

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