---
created: 2025-10-11 18:21
---
# MCP Server Builder Prompt
## INITIAL CLARIFICATIONS
Before generating the MCP server, please provide:
1. **Service/Tool Name**: What service or functionality will this MCP server provide?
GoogleSheet MCMCP server that acts as a bridge between any MCP-compatible client (like Claude Desktop) and the Google Sheets API. It allows you to interact with your Google Spreadsheets using a defined set of tools, enabling powerful automation and data manipulation workflows driven by AI.
2. **API Documentation**: If this integrates with an API, please provide the documentation URL
https://developers.google.com/workspace/sheets/api/guides/concepts
3. **Required Features**: List the specific features/tools you want implemented
list_spreadsheets: Lists spreadsheets in the configured Drive folder (Service Account) or accessible by the user (OAuth).
Returns: List of objects [{id: string, title: string}]
create_spreadsheet: Creates a new spreadsheet.
title (string): The desired title.
Returns: Object with spreadsheet info, including spreadsheetId.
get_sheet_data: Reads data from a range in a sheet.
spreadsheet_id (string)
sheet (string): Name of the sheet.
range (optional string): A1 notation (e.g., 'A1:C10', 'Sheet1!B2:D'). If omitted, reads the whole sheet.
include_grid_data (optional boolean, default False): If True, includes cell formatting and other metadata (larger response). If False, returns values only (more efficient).
Returns: If include_grid_data=True, full grid data with metadata. If False, a values result object from the Values API.
get_sheet_formulas: Reads formulas from a range in a sheet.
spreadsheet_id (string)
sheet (string): Name of the sheet.
range (optional string): A1 notation (e.g., 'A1:C10', 'Sheet1!B2:D'). If omitted, reads the whole sheet.
Returns: 2D array of cell formulas.
update_cells: Writes data to a specific range. Overwrites existing data.
spreadsheet_id (string)
sheet (string)
range (string): A1 notation.
data (2D array): Values to write.
Returns: Update result object.
batch_update_cells: Updates multiple ranges in one API call.
spreadsheet_id (string)
sheet (string)
ranges (object): Dictionary mapping range strings (A1 notation) to 2D arrays of values { "A1:B2": [[1, 2], [3, 4]], "D5": [["Hello"]] }.
Returns: Batch update result object.
add_rows: Appends rows to the end of a sheet (after the last row with data).
spreadsheet_id (string)
sheet (string)
data (2D array): Rows to append.
Returns: Update result object.
list_sheets: Lists all sheet names within a spreadsheet.
spreadsheet_id (string)
Returns: List of sheet name strings ["Sheet1", "Sheet2"].
create_sheet: Adds a new sheet (tab) to a spreadsheet.
spreadsheet_id (string)
title (string): Name for the new sheet.
Returns: New sheet properties object.
get_multiple_sheet_data: Fetches data from multiple ranges across potentially different spreadsheets in one call.
queries (array of objects): Each object needs spreadsheet_id, sheet, and range. [{spreadsheet_id: 'abc', sheet: 'Sheet1', range: 'A1:B2'}, ...].
Returns: List of objects, each containing the query params and fetched data or an error.
get_multiple_spreadsheet_summary: Gets titles, sheet names, headers, and first few rows for multiple spreadsheets.
spreadsheet_ids (array of strings)
rows_to_fetch (optional integer, default 5): How many rows (including header) to preview.
Returns: List of summary objects for each spreadsheet.
share_spreadsheet: Shares a spreadsheet with specified users/emails and roles.
spreadsheet_id (string)
recipients (array of objects): [{email_address: 'user@example.com', role: 'writer'}, ...]. Roles: reader, commenter, writer.
send_notification (optional boolean, default True): Send email notifications.
Returns: Dictionary with successes and failures lists.
add_columns: Adds columns to a sheet.
spreadsheet_id (string)
sheet (string)
num_columns (integer): Number of columns to add.
position (optional integer): Index (1-based) after which to insert new columns. If omitted, adds to the end.
Returns: Updated sheet properties object.
copy_sheet: Duplicates a sheet within a spreadsheet.
spreadsheet_id (string)
sheet_id (integer): ID of the sheet to copy.
new_title (string): Name for the duplicated sheet.
destination_spreadsheet_id (optional string): If provided, copies to another spreadsheet.
Returns: Copied sheet properties object.
rename_sheet: Renames an existing sheet.
spreadsheet_id (string)
sheet_id (integer)
new_title (string)
Returns: Updated sheet properties object.
Additional table-level operations (create_table, get_table_data, insert_table_rows, etc.) should be implemented as described in the appendix
4. **Authentication**: Does this require API keys, OAuth, or other authentication?
Supports either Service Account (via GOOGLE_APPLICATION_CREDENTIALS) or OAuth 2.0 user flow (via stored tokens). Credentials are mounted into the container and loaded securely through environment variables or Docker secrets.
5. **Data Sources**: Will this access files, databases, APIs, or other data sources?
Google Sheets
Build an MCP server that exposes Google Sheets functionality. Use a Python FastMCP app with one decorated function per operation (list_spreadsheets, create_spreadsheet, get_sheet_data, update_cells, add_rows, list_sheets, create_sheet, share_spreadsheet, and table-level functions like create_table, get_table_data, insert_table_rows). Sanitize and validate all inputs, return concise formatted text or JSON results, and include clear error messages.
Run as a non-root service with minimal privileges; load credentials via environment variables (e.g., GOOGLE_APPLICATION_CREDENTIALS, SERVICE_ACCOUNT_EMAIL, OAUTH_REDIRECT_URI). Include pagination/limits for large reads and an option to include or omit grid/format metadata.
Ensure the server only operates on spreadsheets/hosts the user owns or is explicitly authorized to test — for educational use in your own environment.
If any information is missing or unclear, I will ask for clarification before proceeding.
---
# INSTRUCTIONS FOR THE LLM
## YOUR ROLE
You are an expert MCP (Model Context Protocol) server developer. You will create a complete, working MCP server based on the user's requirements.
## CLARIFICATION PROCESS
Before generating the server, ensure you have:
1. **Service name and description** - Clear understanding of what the server does
2. **API documentation** - If integrating with external services, fetch and review API docs
3. **Tool requirements** - Specific list of tools/functions needed
4. **Authentication needs** - API keys, OAuth tokens, or other auth requirements
5. **Output preferences** - Return JSON strings formatted for easy parsing by MCP clients, unless human-readable text is explicitly requested.
If any critical information is missing, ASK THE USER for clarification before proceeding.
## YOUR OUTPUT STRUCTURE
You must organize your response in TWO distinct sections:
### SECTION 1: FILES TO CREATE
Generate EXACTLY these 5 files with complete content that the user can copy and save.
**DO NOT** create duplicate files or variations. Each file should appear ONCE with its complete content.
### SECTION 2: INSTALLATION INSTRUCTIONS FOR THE USER
Provide step-by-step commands the user needs to run on their computer.
Present these as a clean, numbered list without creating duplicate instruction sets.
## CRITICAL RULES FOR CODE GENERATION
1. **NO `@mcp.prompt()` decorators** - They break Claude Desktop
2. **NO `prompt` parameter to FastMCP()** - It breaks Claude Desktop
3. **NO type hints from typing module** - No `Optional`, `Union`, `List[str]`, etc.
4. **NO complex parameter types** - Use `param: str = ""` not `param: str = None`
5. **SINGLE-LINE DOCSTRINGS ONLY** - Multi-line docstrings cause gateway panic errors
6. **DEFAULT TO EMPTY STRINGS** - Use `param: str = ""` never `param: str = None`
7. **ALWAYS return strings from tools** - All tools must return formatted strings
8. **ALWAYS use Docker** - The server must run in a Docker container
9. **ALWAYS log to stderr** - Use the logging configuration provided
10. **ALWAYS handle errors gracefully** - Return user-friendly error messages
## CRITICAL RULES FOR DOCKER MCP CATALOG CONFIGURATION
⚠️ **IMPORTANT**: These rules are based on real-world troubleshooting and are essential for successful Docker MCP Gateway integration.
### Authentication & Credentials
11. **USE VOLUME MOUNTS FOR CREDENTIALS** - Docker MCP secret injection is unreliable
- ❌ DON'T: Use `secrets` section in catalog (values may not be injected)
- ✅ DO: Use `volumes` section to mount credential files directly
- Example:
```yaml
volumes:
- /absolute/path/to/credentials.json:/app/credentials.json:ro
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /app/credentials.json
```
12. **ABSOLUTE PATHS REQUIRED IN VOLUMES** - Template variables don't work
- ❌ DON'T: Use `{{server_name.config_var}}:/app/file.json`
- ✅ DO: Use `/home/user/path/to/file.json:/app/file.json:ro`
- Gateway logs will show `-v :/app/file.json` (empty) if path isn't set correctly
13. **SERVER CODE MUST SUPPORT MULTIPLE AUTH METHODS** - Flexibility is key
- Support file paths: `GOOGLE_APPLICATION_CREDENTIALS=/path/to/file.json`
- Support JSON content: `GOOGLE_CREDENTIALS_JSON={"type":"service_account",...}`
- This allows fallback options if one method fails
### Testing & Debugging
14. **TEST EACH LAYER INDEPENDENTLY** - Isolate problems quickly
- ✅ Layer 1: Direct Python execution (`python server.py`)
- ✅ Layer 2: Direct Docker container (`docker run -v ... -e ...`)
- ✅ Layer 3: Docker MCP Gateway (`docker mcp gateway run`)
- Don't skip layers - each validates different components
15. **GATEWAY LOGS ARE ESSENTIAL** - Look for these indicators
- Success: `> servername: (N tools)` and `N tools listed in X.XXs`
- Failure: `> Can't start servername: failed to connect` and `0 tools listed`
- Check volume mount shows full path: `-v /full/path:/app/file.json:ro`
- Empty path means configuration error: `-v :/app/file.json:ro`
### Catalog Structure
16. **CATALOG MUST HAVE config SECTION** - Even if not using template variables
```yaml
config:
- name: servername
description: Configure authentication
type: object
properties:
credentials_path:
type: string
description: Path to credentials file
required:
- credentials_path
```
17. **USE READ-ONLY MOUNTS** - Security best practice
- Always add `:ro` flag to volume mounts
- Example: `/path/to/creds.json:/app/creds.json:ro`
### Common Pitfalls to Avoid
18. **DON'T RELY ON DOCKER MCP SECRETS** - As of version 2.0.1, unreliable
- Secrets are read by gateway but values aren't injected into containers
- Container receives: `-e VAR_NAME` (empty value)
- Should receive: `-e VAR_NAME=value`
- Use volume mounts instead
19. **VERIFY WORKING SETUP BEFORE DEBUGGING** - Sanity check
- Test credentials file exists and is readable
- Test service account has access to resources
- Test API endpoints are enabled in cloud console
- Test with direct Docker run first
20. **CATALOG CHANGES REQUIRE GATEWAY RESTART** - No hot reload
- After editing catalog: restart gateway completely
- Kill existing process: `pkill -f "docker mcp gateway"`
- Start fresh: `docker mcp gateway run`
---
# SECTION 1: FILES TO CREATE
## File 1: Dockerfile
```dockerfile
# Use Python slim image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Set Python unbuffered mode
ENV PYTHONUNBUFFERED=1
# Copy requirements first for better caching
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the server code
COPY [SERVER_NAME]_server.py .
# Create non-root user
RUN useradd -m -u 1000 mcpuser && \
chown -R mcpuser:mcpuser /app
# Switch to non-root user
USER mcpuser
# Run the server
CMD ["python", "[SERVER_NAME]_server.py"]
```
## File 2: requirements.txt
```
mcp[cli]>=1.2.0
httpx
# Add any other required libraries based on the user's needs
```
## File 3: [SERVER_NAME]_server.py
```python
#!/usr/bin/env python3
"""
Simple [SERVICE_NAME] MCP Server - [DESCRIPTION]
"""
import os
import sys
import logging
from datetime import datetime, timezone
import httpx
from mcp.server.fastmcp import FastMCP
# Configure logging to stderr
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
stream=sys.stderr
)
logger = logging.getLogger("[SERVER_NAME]-server")
# Initialize MCP server - NO PROMPT PARAMETER!
mcp = FastMCP("[SERVER_NAME]")
# Configuration
# Add any API keys, URLs, or configuration here
# API_TOKEN = os.environ.get("[SERVER_NAME_UPPER]_API_TOKEN", "")
# === UTILITY FUNCTIONS ===
# Add utility functions as needed
# === MCP TOOLS ===
# Create tools based on user requirements
# Each tool must:
# - Use @mcp.tool() decorator
# - Have SINGLE-LINE docstrings only
# - Use empty string defaults (param: str = "") NOT None
# - Have simple parameter types
# - Return a formatted string
# - Include proper error handling
# WARNING: Multi-line docstrings will cause gateway panic errors!
@mcp.tool()
async def example_tool(param: str = "") -> str:
"""Single-line description of what this tool does - MUST BE ONE LINE."""
logger.info(f"Executing example_tool with {param}")
try:
# Implementation here
result = "example"
return f"✅ Success: {result}"
except Exception as e:
logger.error(f"Error: {e}")
return f"❌ Error: {str(e)}"
# === SERVER STARTUP ===
if __name__ == "__main__":
logger.info("Starting [SERVICE_NAME] MCP server...")
# Add any startup checks
# if not API_TOKEN:
# logger.warning("[SERVER_NAME_UPPER]_API_TOKEN not set")
try:
mcp.run(transport='stdio')
except Exception as e:
logger.error(f"Server error: {e}", exc_info=True)
sys.exit(1)
```
## File 4: readme.txt
Create a comprehensive readme with all sections filled in based on the implementation.
## File 5: CLAUDE.md
Create a CLAUDE.md file with implementation details and guidelines.
---
# SECTION 2: INSTALLATION INSTRUCTIONS FOR THE USER
After creating the files above, provide these instructions for the user to run:
## Step 1: Save the Files
```bash
# Create project directory
mkdir [SERVER_NAME]-mcp-server
cd [SERVER_NAME]-mcp-server
# Save all 5 files in this directory
```
## Step 2: Build Docker Image
```bash
docker build -t [SERVER_NAME]-mcp-server .
```
## Step 3: Prepare Credentials (if needed)
⚠️ **IMPORTANT**: Use volume mounts for file-based credentials (NOT Docker MCP secrets)
```bash
# For file-based credentials (recommended):
# 1. Place your credentials file in a secure location
# 2. Note the ABSOLUTE path (e.g., /home/user/project/credentials.json)
# 3. You will reference this path in the catalog configuration (Step 4)
# Example:
ls -la /path/to/your/credentials.json # Verify file exists and is readable
```
**Why not secrets?** Docker MCP Gateway (as of v2.0.1) doesn't reliably inject secret values into containers. Volume mounts are more dependable.
## Step 4: Create Custom Catalog
```bash
# Create catalogs directory if it doesn't exist
mkdir -p ~/.docker/mcp/catalogs
# Create or edit custom.yaml
nano ~/.docker/mcp/catalogs/custom.yaml
```
Add this entry to custom.yaml:
```yaml
version: 2
name: custom
displayName: Custom MCP Servers
registry:
[SERVER_NAME]:
description: "[DESCRIPTION]"
title: "[SERVICE_NAME]"
type: server
dateAdded: "[CURRENT_DATE]" # Format: 2025-01-01T00:00:00Z
image: [SERVER_NAME]-mcp-server:latest
ref: ""
readme: ""
toolsUrl: ""
source: ""
upstream: ""
icon: ""
tools:
- name: [tool_name_1]
- name: [tool_name_2]
# List all tools
config:
- name: [SERVER_NAME]
description: Configure authentication
type: object
properties:
credentials_path:
type: string
description: Path to credentials file
required:
- credentials_path
volumes:
- /ABSOLUTE/PATH/TO/credentials.json:/app/credentials.json:ro
# ⚠️ MUST be absolute path (e.g., /home/user/project/creds.json)
# ⚠️ DO NOT use template variables like {{server_name.var}}
env:
- name: [CREDENTIALS_ENV_VAR]
value: /app/credentials.json
# Only include volumes and env if using file-based credentials
metadata:
category: [Choose: productivity|monitoring|automation|integration]
tags:
- [relevant_tag_1]
- [relevant_tag_2]
license: MIT
owner: local
```
## Step 5: Update Registry
```bash
# Edit registry file
nano ~/.docker/mcp/registry.yaml
```
Add this entry under the existing `registry:` key:
```yaml
registry:
# ... existing servers ...
[SERVER_NAME]:
ref: ""
```
**IMPORTANT**: The entry must be under the `registry:` key, not at the root level.
## Step 6: Configure Claude Desktop
Find your Claude Desktop config file:
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
Edit the file and add your custom catalog to the args array:
```json
{
"mcpServers": {
"mcp-toolkit-gateway": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-v", "[YOUR_HOME]/.docker/mcp:/mcp",
"docker/mcp-gateway",
"--catalog=/mcp/catalogs/docker-mcp.yaml",
"--catalog=/mcp/catalogs/custom.yaml",
"--config=/mcp/config.yaml",
"--registry=/mcp/registry.yaml",
"--tools-config=/mcp/tools.yaml",
"--transport=stdio"
]
}
}
}
```
**NOTE**: JSON does not support comments. The custom.yaml catalog line should be added without any comment.
Replace `[YOUR_HOME]` with:
- **macOS**: `/Users/your_username`
- **Windows**: `C:\\Users\\your_username` (use double backslashes)
- **Linux**: `/home/your_username`
## Step 7: Restart Claude Desktop
1. Quit Claude Desktop completely
2. Start Claude Desktop again
3. Your new tools should appear!
## Step 8: Test Your Server
```bash
# Verify it appears in the list
docker mcp server list
# If you don't see your server, check logs:
docker logs [container_name]
```
---
# IMPLEMENTATION PATTERNS FOR THE LLM
## CORRECT Tool Implementation:
```python
@mcp.tool()
async def fetch_data(endpoint: str = "", limit: str = "10") -> str:
"""Fetch data from API endpoint with optional limit."""
# Check for empty strings, not just truthiness
if not endpoint.strip():
return "❌ Error: Endpoint is required"
try:
# Convert string parameters as needed
limit_int = int(limit) if limit.strip() else 10
# Implementation
return f"✅ Fetched {limit_int} items"
except ValueError:
return f"❌ Error: Invalid limit value: {limit}"
except Exception as e:
return f"❌ Error: {str(e)}"
```
## For API Integration:
```python
async with httpx.AsyncClient() as client:
try:
response = await client.get(url, headers=headers, timeout=10)
response.raise_for_status()
data = response.json()
# Process and format data
return f"✅ Result: {formatted_data}"
except httpx.HTTPStatusError as e:
return f"❌ API Error: {e.response.status_code}"
except Exception as e:
return f"❌ Error: {str(e)}"
```
## For System Commands:
```python
import subprocess
try:
result = subprocess.run(
command,
capture_output=True,
text=True,
timeout=10,
shell=True # Only if needed
)
if result.returncode == 0:
return f"✅ Output:\n{result.stdout}"
else:
return f"❌ Error:\n{result.stderr}"
except subprocess.TimeoutExpired:
return "⏱️ Command timed out"
```
## For File Operations:
```python
try:
with open(filename, 'r') as f:
content = f.read()
return f"✅ File content:\n{content}"
except FileNotFoundError:
return f"❌ File not found: {filename}"
except Exception as e:
return f"❌ Error reading file: {str(e)}"
```
## OUTPUT FORMATTING GUIDELINES
Use emojis for visual clarity:
- ✅ Success operations
- ❌ Errors or failures
- ⏱️ Time-related information
- 📊 Data or statistics
- 🔍 Search or lookup operations
- ⚡ Actions or commands
- 🔒 Security-related information
- 📁 File operations
- 🌐 Network operations
- ⚠️ Warnings
Format multi-line output clearly:
```python
return f"""📊 Results:
- Field 1: {value1}
- Field 2: {value2}
- Field 3: {value3}
Summary: {summary}"""
```
## COMPLETE README.TXT TEMPLATE
```markdown
# [SERVICE_NAME] MCP Server
A Model Context Protocol (MCP) server that [DESCRIPTION].
## Purpose
This MCP server provides a secure interface for AI assistants to [MAIN_PURPOSE].
## Features
### Current Implementation
- **`[tool_name_1]`** - [What it does]
- **`[tool_name_2]`** - [What it does]
[LIST ALL TOOLS]
## Prerequisites
- Docker Desktop with MCP Toolkit enabled
- Docker MCP CLI plugin (`docker mcp` command)
[ADD ANY SERVICE-SPECIFIC REQUIREMENTS]
## Installation
See the step-by-step instructions provided with the files.
## Usage Examples
In Claude Desktop, you can ask:
- "[Natural language example 1]"
- "[Natural language example 2]"
[PROVIDE EXAMPLES FOR EACH TOOL]
## Architecture
```
Claude Desktop → MCP Gateway → [SERVICE_NAME] MCP Server → [SERVICE/API]
↓
Docker Desktop Secrets
([SECRET_NAMES])
```
## Development
### Local Testing
```bash
# Set environment variables for testing
export [SECRET_NAME]="test-value"
# Run directly
python [SERVER_NAME]_server.py
# Test MCP protocol
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | python [SERVER_NAME]_server.py
```
### Adding New Tools
1. Add the function to `[SERVER_NAME]_server.py`
2. Decorate with `@mcp.tool()`
3. Update the catalog entry with the new tool name
4. Rebuild the Docker image
## Troubleshooting
### Tools Not Appearing
- Verify Docker image built successfully
- Check catalog and registry files
- Ensure Claude Desktop config includes custom catalog
- Restart Claude Desktop
### Authentication Errors
- Verify secrets with `docker mcp secret list`
- Ensure secret names match in code and catalog
## Security Considerations
- All secrets stored in Docker Desktop secrets
- Never hardcode credentials
- Running as non-root user
- Sensitive data never logged
## License
MIT License
```
## FINAL GENERATION CHECKLIST FOR THE LLM
Before presenting your response, verify:
- [ ] Created all 5 files with proper naming
- [ ] No @mcp.prompt() decorators used
- [ ] No prompt parameter in FastMCP()
- [ ] No complex type hints
- [ ] ALL tool docstrings are SINGLE-LINE only
- [ ] ALL parameters default to empty strings ("") not None
- [ ] All tools return strings
- [ ] Check for empty strings with .strip() not just truthiness
- [ ] Error handling in every tool
- [ ] Clear separation between files and user instructions
- [ ] All placeholders replaced with actual values
- [ ] Usage examples provided
- [ ] Security handled via Docker secrets
- [ ] Catalog includes version: 2, name, displayName, and registry wrapper
- [ ] Registry entries are under registry: key with ref: ""
- [ ] Date format is ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
- [ ] Claude config JSON has no comments
- [ ] Each file appears exactly once
- [ ] Instructions are clear and numbered
### Appendix: Table Functions
list_tables: Lists all defined tables (named ranges or header-based logical tables) within a sheet or spreadsheet.
spreadsheet_id (string)
sheet (optional string): Restrict to a specific sheet.
Returns: List of table definitions [{table_name: string, range: string, header_row: array, row_count: integer}].
create_table: Creates a new logical table (adds headers and optional initial data).
spreadsheet_id (string)
sheet (string)
table_name (string)
headers (array of strings)
data (optional 2D array): Initial rows to insert below the header.
Returns: Object with table range and metadata.
get_table_data: Reads all or part of a table by name.
spreadsheet_id (string)
sheet (string)
table_name (string)
filters (optional object): {column_name: value} or comparison expressions.
limit (optional integer)
offset (optional integer)
Returns: 2D array or list of row objects keyed by headers.
insert_table_rows: Inserts one or more rows into a table at a specified position.
spreadsheet_id (string)
sheet (string)
table_name (string)
rows (2D array)
position (optional integer, default end): 1-based row index within the table (excluding header).
Returns: Update result object.
update_table_rows: Updates existing rows in a table based on matching criteria.
spreadsheet_id (string)
sheet (string)
table_name (string)
match_conditions (object): {column_name: value} to identify rows.
updates (object): {column_name: new_value}
Returns: Object with counts of matched and updated rows.
delete_table_rows: Deletes rows in a table matching specific criteria.
spreadsheet_id (string)
sheet (string)
table_name (string)
match_conditions (object): {column_name: value}
Returns: Deletion summary (count of removed rows).
add_table_columns: Adds new columns to an existing table, updating the header row.
spreadsheet_id (string)
sheet (string)
table_name (string)
new_columns (array of strings)
position (optional integer, default end): Index after which to insert.
Returns: Updated table schema.
rename_table_column: Renames a header in an existing table.
spreadsheet_id (string)
sheet (string)
table_name (string)
old_name (string)
new_name (string)
Returns: Updated header row.
merge_tables: Merges data from two tables (inner/left/right join behavior).
spreadsheet_id (string)
sheet (string)
left_table (string)
right_table (string)
join_columns (array of strings): Common column names or pairs.
join_type (optional string, default 'inner'): inner, left, right, full.
destination_sheet (optional string): If provided, writes merged result there.
Returns: Object with merged row count and output range.
export_table_as_csv: Exports a table to CSV format (returns data URI or temporary file path).
spreadsheet_id (string)
sheet (string)
table_name (string)
include_headers (optional boolean, default True)
Returns: Object with CSV data or file reference.
import_csv_to_table: Imports a CSV file or content into a new or existing table.
spreadsheet_id (string)
sheet (string)
table_name (string)
csv_content (string or file reference)
overwrite (optional boolean, default False): Replace existing data if table exists.
Returns: Import summary (row/column counts).