# toolSource

```graphql
query ToolSource($projectReference: String!, $id: String!) {
  toolSource(projectReference: $projectReference, id: $id) {
    id
    name
    description
    sourcePath
    source
    editMode
    sourceOnlyReasons
  }
}
```

Read the editable source behind one project tool before changing it; returns the tool with its source text, edit mode and the reasons it can only be edited as source. Requires project.agents.read.

## Arguments

| Name                  | Type                 | Required | Description                                                                                                                                            |
| --------------------- | -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `projectReference`    | String!              | Yes      |                                                                                                                                                        |
| `id`                  | String!              | Yes      | The id of the definition, from its list.                                                                                                               |
| `sourceTargetKind`    | SourceReadTargetKind |          | The source to read; default runtimeTargetKind, else project. main\_branch reads the project source. One of `project`, `main_branch`, `preview_branch`. |
| `runtimeTargetKind`   | RuntimeTargetKind    |          | Used as the source to read when sourceTargetKind is omitted. One of `main_branch`, `environment`, `preview_branch`.                                    |
| `targetBranchId`      | ID                   |          | Required with the kind preview\_branch.                                                                                                                |
| `targetEnvironmentId` | ID                   |          | Not supported for source reads; a non-null value is refused as invalid\_input.                                                                         |

## Variables

```json
{
  "projectReference": "string",
  "id": "string"
}
```

## Responses

| Status | Description                         |
| ------ | ----------------------------------- |
| 200    | The ToolSource! in data.toolSource. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query ToolSource($projectReference: String!, $id: String!) {\n  toolSource(projectReference: $projectReference, id: $id) {\n    id\n    name\n    description\n    sourcePath\n    source\n    editMode\n    sourceOnlyReasons\n  }\n}",
  "variables": {
    "projectReference": "string",
    "id": "string"
  }
}'
```

## Example response

```json
{
  "data": {
    "toolSource": {
      "id": "string",
      "name": "string",
      "description": "string",
      "sourcePath": "string",
      "source": "string",
      "editMode": "structured",
      "sourceOnlyReasons": [
        "string"
      ]
    }
  }
}
```
