Skip to content

Conversation

MariusWilsch
Copy link

Summary

Replaces the verbose read_data_from_excel tool with a new read_excel tool that reduces output by 92.5% (from 31,362 to 2,362 characters) by returning only non-null cells without validation metadata.

Task Link

Task: User feedback - Excel MCP tool returns excessive metadata making it unusable for AI agents needing clean data

How to Test

  1. Install dependencies and start the server:

    uv sync
    uv run python -m excel_mcp stdio
  2. Test with the included MailAvis.xlsx file to see the reduction:

    # Compare old vs new output size
    uv run python -c "
    from src.excel_mcp.data import read_excel_range_with_metadata, read_excel_sparse
    import json
    
    # OLD verbose function (still available for comparison)
    old = read_excel_range_with_metadata('MailAvis.xlsx', 'Tabelle1', 'A1:J20')
    old_json = json.dumps(old, indent=2, default=str)
    
    # NEW sparse function
    new = read_excel_sparse('MailAvis.xlsx', 'Tabelle1', 'A1:J20') 
    new_json = json.dumps(new, indent=2, default=str)
    
    print(f'Old tool: {len(old_json):,} characters, {len(old["cells"])} cells')
    print(f'New tool: {len(new_json):,} characters, {len(new["cells"])} cells')
    print(f'Reduction: {(1 - len(new_json)/len(old_json))*100:.1f}%')
    "
  3. Verify the new MCP tool returns only non-null cells:

    • Connect an MCP client to the server
    • Call read_excel with any Excel file containing sparse data
    • Observe only cells with values are returned (no null cells)

Expected Result:

  • Output shows ~92.5% character reduction
  • Only 22 non-null cells returned instead of 200 total cells
  • No validation metadata in the output (clean structure with just address, value, row, column)

⚠️ Deployment Notes

BREAKING CHANGE:

  • The read_data_from_excel tool has been removed and replaced with read_excel
  • Any MCP clients using the old tool name will need to update to the new name
  • The output structure is cleaner but different (no validation metadata)

Migration path:

  • Old tool: mcp__excel__read_data_from_excel
  • New tool: mcp__excel__read_excel
  • Output format: Still JSON but only non-null cells, no validation field

🤖 Generated with Claude Code

…uction)

- Replace read_data_from_excel with read_excel tool
- New read_excel_sparse() function returns only non-null cells
- Removes validation metadata bloat (address, value, row, column only)
- Reduces output from 31,362 to 2,362 characters on test data
- Optimized for AI processing of unpredictable Excel structures

BREAKING CHANGE: read_data_from_excel tool removed, use read_excel instead

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant