# Create tool

```http
POST /projects/{project_reference}/tools
```

Create a project tool source file in the project source or a preview branch so project agents can call it; returns the tool source document. Requires project.agents.write.

## Parameters

| Name                 | In    | Required | Description                                                |
| -------------------- | ----- | -------- | ---------------------------------------------------------- |
| `project_reference`  | path  | Yes      | Project slug, UUID, or domain that identifies the project. |
| `source_target_kind` | query |          |                                                            |
| `target_branch_id`   | query |          |                                                            |

## Request body

| Field         | Type        | Required | Description                                                                                                                              |
| ------------- | ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | string      | Yes      | Tool ID, a lowercase slug; it also names the tool source file.                                                                           |
| `description` | string,null |          | Tool description. Null leaves it empty. On update, REST and GraphQL clear an omitted description and the MCP tool keeps the current one. |
| `source`      | string      |          | Complete TypeScript source of the tool file. When set it is written as-is and description is ignored.                                    |

## Responses

| Status | Description           |
| ------ | --------------------- |
| 201    | Created tool document |
| 400    | Bad request           |
| 401    | Unauthorized          |
| 403    | Forbidden             |
| 409    | Conflict              |
