Skip to main content
Glama
taylorwilsdon

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

list_docs_in_folder

Retrieve a formatted list of Google Docs within a specified Drive folder using the Google Workspace MCP Server. Streamline document organization and access with straightforward folder queries.

Instructions

Lists Google Docs within a specific Drive folder. Returns: str: A formatted list of Google Docs in the specified folder.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folder_idNoroot
page_sizeNo
serviceYes
user_google_emailYes

Implementation Reference

  • The core handler function that executes the tool logic: lists Google Docs files in a specified Drive folder using the Google Drive API, formats the results, and returns a string summary.
    async def list_docs_in_folder( service: Any, user_google_email: str, folder_id: str = 'root', page_size: int = 100 ) -> str: """ Lists Google Docs within a specific Drive folder. Returns: str: A formatted list of Google Docs in the specified folder. """ logger.info(f"[list_docs_in_folder] Invoked. Email: '{user_google_email}', Folder ID: '{folder_id}'") rsp = await asyncio.to_thread( service.files().list( q=f"'{folder_id}' in parents and mimeType='application/vnd.google-apps.document' and trashed=false", pageSize=page_size, fields="files(id, name, modifiedTime, webViewLink)", supportsAllDrives=True, includeItemsFromAllDrives=True ).execute ) items = rsp.get('files', []) if not items: return f"No Google Docs found in folder '{folder_id}'." out = [f"Found {len(items)} Docs in folder '{folder_id}':"] for f in items: out.append(f"- {f['name']} (ID: {f['id']}) Modified: {f.get('modifiedTime')} Link: {f.get('webViewLink')}") return "\n".join(out)
  • Registers the 'list_docs_in_folder' tool with the MCP server using the @server.tool() decorator.
    @server.tool()

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/taylorwilsdon/google_workspace_mcp'

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