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

# Tools reference

> The five AnythingMD MCP tools, their arguments and what they return. For building on the server.

You don't need this page to use AnythingMD from an agent: the tool descriptions tell the agent what to do. It's for people building agents, prompts or evaluations on top of the server.

| Tool | Scope | Purpose |
| - | - | - |
| `convert_to_markdown` | `documents:write` | Convert a public URL or an uploaded file, wait, and return the first page of Markdown |
| `create_upload` | `documents:write` | Get a short-lived upload link for a local file |
| `get_conversion` | `documents:read` | Check a running conversion, or read the next page of a long one |
| `get_pricing` | `documents:read` | Optional. Estimate credits before converting |
| `cancel_job` | `documents:write` | Cancel a queued conversion, or stop a running one |

Each tool calls the same handler as the [REST API](/api-reference/introduction.md), so scopes, credits, idempotency and error codes are identical. Never put file bytes or base64 in tool arguments; use `create_upload`.

## convert\_to\_markdown

| Argument | Type | Notes |
| - | - | - |
| `fileUrl` | string | Public HTTPS link to the file. Give `fileUrl` or `documentId`, not both |
| `documentId` | string | From `create_upload`, after the upload finished |
| `fileName` | string, optional | Name for a URL source; defaults to the URL path |
| `includeImages` | boolean, optional | Store extracted images and return their links |
| `idempotencyKey` | string, optional | Reuse it on a retry to get the original job instead of a second, charged one |

The server waits up to about 50 seconds in total, counted from the start of the call, then returns one of three things.

**Finished.** The tool text is the first page of Markdown (up to about 20,000 tokens), then a footer:

```markdown theme={null}
# Report title

The document text as Markdown...

---
jobId: job_...
creditsReserved: 30
creditsReserved is an estimate of the hold, not the final price. The amount charged can differ.
creditsCharged: 30
estimatedTokens: 1842 (full cleaned Markdown)
markdownDownloadUrl: https://...
nextCursor: eyJ2IjoxLCJvIjo4MDAwMH0
```

`structuredContent` carries the same fields. `nextCursor` appears only when more Markdown remains. `markdownDownloadUrl` is the whole document; it's signed and expires, so pass it on exactly as returned, including everything after `?`. Report `creditsCharged`, not `creditsReserved`.

**Still running.** The text says so and gives the `jobId`; call `get_conversion` with it. Starting a second conversion of the same file doesn't help and can be charged twice.

**Refused or failed.** `isError` is set and the text names the cause and whether a retry can help. Failed and canceled jobs are not charged. Codes are listed in [Errors](/errors.md).

## create\_upload

| Argument | Type | Notes |
| - | - | - |
| `fileName` | string | Name with extension, for example `report.pdf` |
| `fileType` | string | MIME type, for example `application/pdf` |
| `fileSize` | integer, optional | Bytes. A file over 100 MB is refused before a slot is created |

Returns `documentId`, `uploadUrl` with the `Content-Type` to send, `expiresAt`, a ready `curl -X PUT -T` command for agents with a shell, and `browserUploadUrl` for agents without one (the user opens it and picks the file). After the upload finishes, call `convert_to_markdown` with the `documentId`. An expired slot can't be reused; call `create_upload` again.

## get\_conversion

| Argument | Type | Notes |
| - | - | - |
| `jobId` | string | From a "still running" reply |
| `cursor` | string, optional | The `nextCursor` from a previous page. Omit for the first page |

Each call advances the job once. Replies have the same shapes as `convert_to_markdown`.

### When to stop paging

The page cap protects one reply, not the whole conversation. Do not walk every page into context: an agent that follows every `nextCursor` fills its own context window with a document it may not need.

Stop after the first page unless there is a reason to continue:

| What is needed | What to do |
| - | - |
| The document as a file | Give the user `markdownDownloadUrl`. Don't page |
| A summary, or an answer near the start | Use the first page |
| A specific later section | Pass `cursor` until that section appears, then stop |
| Every page, for indexing or bulk work | Download `markdownDownloadUrl` and process it outside the conversation |

Treat `nextCursor` as an option to decline, not a queue to drain.

## get\_pricing

| Argument | Type | Notes |
| - | - | - |
| `fileUrl` | string | Give `fileUrl` or `documentId`, not both |
| `documentId` | string | From `create_upload` |
| `fileName` | string, optional | Name for a URL source |
| `idempotencyKey` | string, optional | Replays the same quote |

Returns `estimatedCredits` and `maximumCredits` (what the workspace must have available to start). A URL whose server doesn't report a size can't be quoted, but can still be converted. `convert_to_markdown` reports the credits it reserved, so this call is optional.

## cancel\_job

| Argument | Type | Notes |
| - | - | - |
| `jobId` | string | The conversion to cancel |

A queued job is canceled at once. A running job stops at its next step; `get_conversion` then reports it as canceled. Canceled jobs are not charged.


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