# Summarize Text — TextCortex

> Summarize given text. The text can be provided as a string or as a file ID. See the documentation

- Key: `textcortex-summarize-text`
- Type: Action (Write)
- Version: 0.0.3
- App: TextCortex (`textcortex`) — https://pipedream.com/apps/textcortex.md
- This page (HTML): https://pipedream.com/apps/textcortex/actions/summarize-text
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/textcortex/actions/summarize-text/summarize-text.mjs

## Description

Summarize given text. The text can be provided as a string or as a file ID. [See the documentation](https://docs.textcortex.com/api/paths/texts-summarizations/post)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `fileId` | `string` | No | The ID of the file to summarize. string<uuid> Example: 8a0cfb4f-ddc9-436d-91bb-75133c583767 |
| `maxTokens` | `integer` | No | The maximum number of tokens to generate. |
| `mode` | `string` | No | The summarization mode. |
| `model` | `string` | No | The language model to use. Allowed values: velox-1, aecus-1, alta-1, sophos-1 and chat-sophos-1 |
| `n` | `integer` | No | The number of outputs to generate. |
| `sourceLang` | `string` | No | The language of the source text. |
| `targetLang` | `string` | No | The language which the text should be generated in. |
| `temperature` | `string` | No | The sampling temperature to be used in text generation. The higher the temperature, the higher the risk of the output to sound "made up". |
| `text` | `string` | No | The text to summarize. |

## 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": "textcortex",
      },
    },
  },
)

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: "textcortex-summarize-text",
  arguments: {
    fileId: "File ID",
    maxTokens: 10,
  },
})
```

**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: "textcortex-summarize-text",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    textcortex: { authProvisionId: "apn_xxxxxxx" },
    fileId: "File ID",
    maxTokens: 10,
  },
})

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": "textcortex-summarize-text",
    "configured_props": {
      "textcortex": { "authProvisionId": "apn_xxxxxxx" },
      "fileId": "File ID",
      "maxTokens": 10
    }
  }'
```

---

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