Skip to main content
Glama

sheets_get_metadata

Retrieve metadata from Google Sheets, including sheet names, IDs, and properties, by providing the spreadsheet ID for efficient data management.

Instructions

Get metadata about a Google Sheets spreadsheet including sheet names, IDs, and properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spreadsheetIdYesThe ID of the spreadsheet (found in the URL after /d/)

Implementation Reference

  • The handler function that implements the core logic: validates input, fetches spreadsheet metadata via Google Sheets API, formats the response, and handles errors.
    export async function handleGetMetadata(input: any) {
      try {
        if (!input.spreadsheetId || typeof input.spreadsheetId !== 'string') {
          throw new Error('spreadsheetId is required and must be a string');
        }
    
        if (!validateSpreadsheetId(input.spreadsheetId)) {
          throw new Error('Invalid spreadsheet ID format');
        }
    
        const sheets = await getAuthenticatedClient();
    
        const response = await sheets.spreadsheets.get({
          spreadsheetId: input.spreadsheetId,
          includeGridData: false,
        });
    
        return formatSpreadsheetMetadata(response.data);
      } catch (error) {
        return handleError(error);
      }
    }
  • Defines the tool's name, description, and input schema for validation.
    export const getMetadataTool: Tool = {
      name: 'sheets_get_metadata',
      description:
        'Get metadata about a Google Sheets spreadsheet including sheet names, IDs, and properties',
      inputSchema: {
        type: 'object',
        properties: {
          spreadsheetId: {
            type: 'string',
            description: 'The ID of the spreadsheet (found in the URL after /d/)',
          },
        },
        required: ['spreadsheetId'],
      },
    };
  • src/index.ts:36-36 (registration)
    Registers the handler function for 'sheets_get_metadata' in the toolHandlers Map used for tool execution.
    ['sheets_get_metadata', tools.handleGetMetadata],
  • src/index.ts:71-71 (registration)
    Registers the tool definition (schema) in the allTools array served via ListToolsRequest.
    tools.getMetadataTool,
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does but lacks critical behavioral details: it doesn't mention permissions required (e.g., read access), rate limits, error conditions (e.g., invalid ID), or output format (e.g., JSON structure). For a read operation with zero annotation coverage, this is inadequate, scoring 2.

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 sentence that front-loads the core purpose ('Get metadata about a Google Sheets spreadsheet') and specifies key details (sheet names, IDs, properties). Every word earns its place with zero redundancy, making it highly concise and well-structured.

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 moderate complexity (retrieving metadata from an external API), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like authentication needs, error handling, or return values, leaving gaps for an AI agent to invoke it correctly. This scores 2 as it should provide more context.

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?

Schema description coverage is 100%, with the single parameter 'spreadsheetId' fully documented in the schema (including URL location hint). The description adds no additional parameter semantics beyond what the schema provides—it doesn't explain format constraints or usage examples. With high schema coverage, the baseline is 3.

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 verb 'Get' and the resource 'metadata about a Google Sheets spreadsheet', specifying what information is retrieved (sheet names, IDs, and properties). It distinguishes from siblings like sheets_get_values (which retrieves cell data) by focusing on structural metadata rather than content. However, it doesn't explicitly contrast with all siblings, keeping it at 4 rather than 5.

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 prerequisites (e.g., needing spreadsheet access), compare it to similar tools like sheets_check_access (which verifies permissions), or specify use cases (e.g., before editing sheet structure). Without any when/when-not context, it scores 2.

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/freema/mcp-gsheets'

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