> ## Documentation Index
> Fetch the complete documentation index at: https://dialnexa.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview Batch Call Leads

> Use the preview_batch_call_leads MCP tool on the DialNexa remote MCP server.

Read only

Parses a small CSV/Excel leads file WITHOUT creating anything — same preview/validation the dashboard's batch call upload wizard runs before letting a batch start. Returns how many rows are valid vs. invalid, and for each invalid row, which phone number failed and why (bad country code, invalid length, destination not allowed by this org's calling rules, etc.). Use this on the file before create\_batch\_call: if invalid\_row\_count > 0, show the user the specific bad rows, get them fixed or dropped, then call create\_batch\_call with the corrected file. Same file\_base64 size limit as create\_batch\_call (a few dozen rows).

## Parameters

| Name | Type | Required | Description |
| - | - | - | - |
| `agent_id` | `string` | Yes | The agent ID the batch would use, e.g. agent\_abc123 — needed to resolve which org phone number/calling rules to validate against |
| `agent_version_number` | `string` | Yes | The specific published agent version — same requirement as create\_batch\_call |
| `phone_number_id` | `string` | No | The agent's outbound number the batch would dial from, e.g. phn\_abc123 — required when the agent has more than one (list\_agent\_phone\_numbers) |
| `file_name` | `string` | No | File name with extension, e.g. leads.csv or leads.xlsx. Required with file\_text/file\_base64; taken from the upload otherwise. |
| `file_text` | `string` | No | For rows the user typed into the conversation, or a small CSV/text file (under \~50 KB) the caller can read. Plain text, header row first. Not for a file the user attached in the chat: pass that as `file`. Lead columns are for calling context such as names and appointment details. Never include payment card numbers, bank account numbers, government ID numbers, passwords, health information or biometric data. |
| `file_base64` | `string` | No | For a small .xlsx (under \~50 KB) the caller can read from disk. Not for a file the user attached in the chat (pass that as `file`), and not for larger files (use create\_upload\_url). |
| `upload_id` | `string` | No | For a file on a machine the caller controls that is too large for file\_text (over \~50 KB): call create\_upload\_url with reveal\_url: true, upload the bytes with an HTTP PUT from a machine with internet access, then pass the upload\_id here. Not for a file the user attached in the chat (pass that as `file`); chat sandboxes without internet access cannot complete the upload. |
| `file` | `object` | No | The file the user attached in the chat. The host passes it as a download link for the server. Preferred for any attachment, of any size; pass the attachment as is, without opening, converting or encoding it. |

## Complete input schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "agent_id": {
      "type": "string",
      "description": "The agent ID the batch would use, e.g. agent_abc123 — needed to resolve which org phone number/calling rules to validate against"
    },
    "agent_version_number": {
      "type": "string",
      "description": "The specific published agent version — same requirement as create_batch_call"
    },
    "phone_number_id": {
      "type": "string",
      "description": "The agent's outbound number the batch would dial from, e.g. phn_abc123 — required when the agent has more than one (list_agent_phone_numbers)"
    },
    "file_name": {
      "type": "string",
      "description": "File name with extension, e.g. leads.csv or leads.xlsx. Required with file_text/file_base64; taken from the upload otherwise."
    },
    "file_text": {
      "type": "string",
      "description": "For rows the user typed into the conversation, or a small CSV/text file (under ~50 KB) the caller can read. Plain text, header row first. Not for a file the user attached in the chat: pass that as `file`. Lead columns are for calling context such as names and appointment details. Never include payment card numbers, bank account numbers, government ID numbers, passwords, health information or biometric data."
    },
    "file_base64": {
      "type": "string",
      "description": "For a small .xlsx (under ~50 KB) the caller can read from disk. Not for a file the user attached in the chat (pass that as `file`), and not for larger files (use create_upload_url)."
    },
    "upload_id": {
      "type": "string",
      "description": "For a file on a machine the caller controls that is too large for file_text (over ~50 KB): call create_upload_url with reveal_url: true, upload the bytes with an HTTP PUT from a machine with internet access, then pass the upload_id here. Not for a file the user attached in the chat (pass that as `file`); chat sandboxes without internet access cannot complete the upload."
    },
    "file": {
      "type": "object",
      "properties": {
        "file_id": {
          "type": "string",
          "description": "Host-side file id"
        },
        "download_url": {
          "type": "string",
          "description": "Short-lived signed URL the host provides for the attached file"
        },
        "file_name": {
          "type": "string"
        },
        "mime_type": {
          "type": "string"
        },
        "size": {
          "type": "number"
        }
      },
      "required": [
        "file_id",
        "download_url"
      ],
      "additionalProperties": false,
      "description": "The file the user attached in the chat. The host passes it as a download link for the server. Preferred for any attachment, of any size; pass the attachment as is, without opening, converting or encoding it."
    }
  },
  "required": [
    "agent_id",
    "agent_version_number"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

## Registered output schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "total_rows": {
      "description": "Total rows parsed from the file (valid + invalid)"
    },
    "valid_row_count": {
      "description": "Rows that passed phone-number and destination validation"
    },
    "invalid_row_count": {
      "description": "Rows that failed validation"
    },
    "invalid_rows": {
      "description": "The invalid rows — which phone number failed and why"
    },
    "dnc_skipped_count": {
      "description": "Rows left out because their number is on the workspace's DNC list. Not invalid: these numbers are never called, and the batch is created without them"
    },
    "file_source": {
      "type": "string",
      "description": "How the file arrived: 'text', 'base64', 'upload' (create_upload_url) or 'attachment' (the chat attachment)"
    }
  },
  "required": [
    "file_source"
  ],
  "additionalProperties": true,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

## Before you call

* Connect and initialize the MCP client with OAuth or an API key for the intended workspace.
* Provide the required parameters: `agent_id`, `agent_version_number`.
* If your OAuth grant covers several workspaces, also pass `organization_id` with the workspace to act in, from [List My Organizations](https://dialnexa.com/docs/mcp-tools/organization/list-my-organizations.md).
* Provide one file source: a host attachment, a completed upload\_id, or supported inline content. The optional file fields are alternatives; omitting all of them does not submit a file. See [MCP file uploads](https://dialnexa.com/docs/mcp-tools/quickstart.md#mcp-file-uploads).

## Example MCP request

Send `tools/call` after your client completes MCP initialization. Replace placeholder values with IDs and inputs from your workspace. For object and array parameters, follow the nested requirements in the parameter description instead of treating an empty value as complete.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "preview_batch_call_leads",
    "arguments": {
      "agent_id": "agent_abc123",
      "agent_version_number": "1",
      "upload_id": "COMPLETED_UPLOAD_ID"
    }
  }
}
```

Successful results include `structuredContent` and a text content block containing the same JSON. Check `isError` first, then read `structuredContent` or parse `content[0].text`. See [MCP responses and errors](https://dialnexa.com/docs/mcp-tools/errors.md) for the full envelope and failure behavior.

## Verify the result

Confirm the response is not marked `isError`, parse `content[0].text` as JSON, and verify that returned IDs and workspace data match the request.

## Retry safety

This tool does not change workspace data. Retrying after a transient transport failure is safe.

## Related MCP tools

* [Create Batch Call](https://dialnexa.com/docs/mcp-tools/batch-calls/create-batch-call.md): `create_batch_call`
* [Create Upload URL](https://dialnexa.com/docs/mcp-tools/uploads/create-upload-url.md): `create_upload_url`
* [List Agent Phone Numbers](https://dialnexa.com/docs/mcp-tools/phone-numbers/list-agent-phone-numbers.md): `list_agent_phone_numbers`

## Related guides

* [Connect to the DialNexa MCP server](https://dialnexa.com/docs/mcp-tools/overview.md)
* [Batch Calls MCP tools](https://dialnexa.com/docs/mcp-tools/batch-calls/overview.md)
* [MCP responses and errors](https://dialnexa.com/docs/mcp-tools/errors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.