# Get File — Google Drive

> Get full metadata for a file or folder by its ID. Returns name, MIME type, size, parent folders, sharing permissions, web links, creation/modification dates, and more. Use Search Files first to find the file ID if you only have the file…

- Key: `google_drive-get-file`
- Type: Action (Read-only)
- Version: 0.0.4
- App: Google Drive (`google_drive`) — https://pipedream.com/apps/google-drive.md
- This page (HTML): https://pipedream.com/apps/google-drive/actions/get-file
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_drive/actions/get-file/get-file.mjs

## Description

Get full metadata for a file or folder by its ID. Returns name, MIME type, size, parent folders, sharing permissions, web links, creation/modification dates, and more. Use **Search Files** first to find the file ID if you only have the file name. By default returns all fields. Pass specific field names to `fields` to reduce the response size.

Common fields: `id`, `name`, `mimeType`, `size`, `parents`, `webViewLink`, `webContentLink`, `createdTime`, `modifiedTime`, `owners`, `permissions`, `description`, `trashed`. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/get)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `fileId` | `string` | Yes | The ID of the file or folder to retrieve. Use Search Files to find the file ID by name. |
| `fields` | `string` | No | Comma-separated list of fields to include in the response. Example: id,name,mimeType,webViewLink,parents,permissions. Omit to return all fields. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "google_drive",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_drive-get-file",
  arguments: {
    fileId: "File ID",
    fields: "Fields",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_drive-get-file",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_drive: { authProvisionId: "apn_xxxxxxx" },
    fileId: "File ID",
    fields: "Fields",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "google_drive-get-file",
    "configured_props": {
      "google_drive": { "authProvisionId": "apn_xxxxxxx" },
      "fileId": "File ID",
      "fields": "Fields"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-drive.md · All apps: https://pipedream.com/apps
