Skip to main content
Glama

google_drive_list_files

Retrieve and organize files from Google Drive using search queries, sorting, and field selection. Specify parameters like query, page size, and order to customize results.

Instructions

List files from Google Drive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoFields to include in the response (use Google Drive API syntax)
orderByNoComma-separated field names to sort by (e.g., 'modifiedTime desc')
pageSizeNoMaximum number of files to return (default: 10)
queryNoGoogle Drive search query (e.g., 'name contains "report"')

Implementation Reference

  • The handler function that implements the core logic for the google_drive_list_files tool, including argument validation and calling the Google Drive API via the instance.
    export async function handleDriveListFiles(
      args: any,
      googleDriveInstance: GoogleDrive
    ) {
      if (!isListFilesArgs(args)) {
        throw new Error("Invalid arguments for google_drive_list_files");
      }
      const { query, pageSize, orderBy, fields } = args;
      const result = await googleDriveInstance.listFiles(
        query,
        pageSize,
        orderBy,
        fields
      );
      return {
        content: [{ type: "text", text: result }],
        isError: false,
      };
    }
  • The TypeScript type definition and JSON schema for the tool's input parameters.
    export const LIST_FILES_TOOL: Tool = {
      name: "google_drive_list_files",
      description: "List files from Google Drive",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description:
              "Google Drive search query (e.g., 'name contains \"report\"')",
          },
          pageSize: {
            type: "number",
            description: "Maximum number of files to return (default: 10)",
          },
          orderBy: {
            type: "string",
            description:
              "Comma-separated field names to sort by (e.g., 'modifiedTime desc')",
          },
          fields: {
            type: "string",
            description:
              "Fields to include in the response (use Google Drive API syntax)",
          },
        },
      },
    };
  • The switch case in the MCP server's call tool request handler that registers and routes invocations of google_drive_list_files to its handler function.
    case "google_drive_list_files":
      return await driveHandlers.handleDriveListFiles(
        args,
        googleDriveInstance
      );
  • Helper type guard function for validating the input arguments to the google_drive_list_files tool.
    export function isListFilesArgs(args: any): args is {
      query?: string;
      pageSize?: number;
      orderBy?: string;
      fields?: string;
    } {
      return (
        args &&
        (args.query === undefined || typeof args.query === "string") &&
        (args.pageSize === undefined || typeof args.pageSize === "number") &&
        (args.orderBy === undefined || typeof args.orderBy === "string") &&
        (args.fields === undefined || typeof args.fields === "string")
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'List files' implies a read-only operation, but it doesn't specify aspects like authentication requirements, rate limits, pagination behavior (beyond the 'pageSize' parameter in the schema), or what happens on errors. For a tool with no annotation coverage, this is a significant gap in transparency.

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 with zero wasted words. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration, earning a high score for conciseness.

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 complexity of a Google Drive listing tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral traits, return values, or usage context, leaving significant gaps for the agent to understand how to effectively invoke and interpret results from this tool.

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 input schema has 100% description coverage, with clear documentation for all four parameters (fields, orderBy, pageSize, query). The description adds no additional meaning beyond what the schema provides, such as examples or context for parameter usage. According to the rules, with high schema coverage (>80%), the baseline score is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List files from Google Drive' clearly states the verb ('List') and resource ('files from Google Drive'), making the basic purpose understandable. However, it lacks specificity about scope (e.g., all files vs. user's files) and doesn't distinguish it from potential sibling tools like 'google_drive_get_file_content' or other listing operations, making it somewhat vague.

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 any context, prerequisites, or exclusions, such as how it differs from other Google Drive tools (e.g., 'google_drive_create_file' for creation). This leaves the agent without explicit usage instructions.

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/vakharwalad23/google-mcp'

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