# proc_kill

Send a signal to one process of the user cmdop runs as (default term) and wait up to 3 s for it to end. For processes cmdop did not start; a cmdop task is stopped with task_stop. The machine program itself, pid 1 and other users' processes are refused.

**In short:** Risk class [`destructive`](https://docs.cmdop.ai/reference/tools.md#risk-classes). Over MCP call `proc_kill`; over HTTP send `"tool": "proc_kill"` to [`POST /api/v1/call`](https://docs.cmdop.ai/reference/http/post-call.md).

## Arguments

Over MCP every tool also takes `machine`: the machine's name or id, optional when only one machine is online.

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `pid` | `integer` | yes |  |
| `signal` | `"term" | "int" | "hup" | "kill"` | no | `term` (default), `int`, `hup` or `kill`. |
| `wait_secs` | `integer` | no | Seconds to wait for the process to end (default 3, at most 30). |

## Result

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `exited` | `boolean` | yes | The process was gone within `wait_secs`. |
| `pid` | `integer` | yes |  |
| `signal` | `"term" | "int" | "hup" | "kill"` | yes |  |

## Examples

**MCP**

```json
{
  "name": "proc_kill",
  "arguments": {
    "machine": "<machine>",
    "pid": 0
  }
}
```

**HTTP**

```bash
curl -sS -X POST "https://<contour>.cmdop.ai/api/v1/call" \
  -H "Authorization: Bearer $CMDOP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"machine":"<machine>","tool":"proc_kill","args":{"pid":0}}'
```

## Limits

The call times out after 40 s (`timed_out`). Available since version 0.0.1. A refused or failed call returns one of the [error codes](https://docs.cmdop.ai/reference/errors.md).
