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

# Create a tool in the workbench

> Draft a tool with the tool drafter, test-run it, and save it.

`merged_prs` lists the pull requests merged since a date by running the `gh` CLI.

```yaml .graph/tools/merged_prs.yaml theme={null}
name: merged_prs
description: Pull requests merged into this repository since a date, as number, title and merge time.
kind: exec
command: gh
args:
  - pr
  - list
  - --state
  - merged
  - --search
  - "merged:>={{input.since}}"
  - --json
  - number,title,mergedAt
read_only: true
input_schema:
  type: object
  required: [since]
  properties:
    since:
      type: string
      description: The earliest merge date, as YYYY-MM-DD
```

**1. Open the workbench in tool mode**

```bash theme={null}
graph workbench tool
```

**2. Describe the tool**

Say what goes in, what comes back, and which command or API it uses. The drafter checks your catalog for a tool that already does it, then puts a first draft in the pane and asks what it can't settle itself.

![The workbench with tool\_drafter active: the request and the drafter's question on the left, and the merged\_prs draft on the right with its description, kind exec, the gh command it runs, its since input, and no problems.](https://mintcdn.com/graph/s-Ce0Orb66xMgIkN/images/workbench/tool-drafting.svg?fit=max\&auto=format\&n=s-Ce0Orb66xMgIkN\&q=85\&s=fa3e35e352e1b7fe7d5f141c2b487e1d)

**3. Test-run it**

Answer its questions and ask it to test the tool. It runs the draft on a sample input once you approve the run:

![The workbench's approval form asking whether to test-run user\_\_merged\_prs once with the command gh pr list --state merged --search merged:>=\{\{input.since}} --json number,title,mergedAt and the input since 2026-09-24, with run set to true.](https://mintcdn.com/graph/s-Ce0Orb66xMgIkN/images/workbench/tool-try.svg?fit=max\&auto=format\&n=s-Ce0Orb66xMgIkN\&q=85\&s=d29c398d006c88b887ba86938bb5099e)

The result shows in the pane:

```json theme={null}
[
  {
    "mergedAt": "2026-10-09T02:25:01Z",
    "number": 147,
    "title": "feat!: plans state how they finish with a required finish key…"
  },
  {
    "mergedAt": "2026-10-08T19:34:56Z",
    "number": 146,
    "title": "feat!: workbench agents work on plans through the same artifact tools…"
  },
  …
]
```

**4. Save**

Press <kbd>Ctrl</kbd>+<kbd>S</kbd>. graph writes the file to `./.graph/tools/merged_prs.yaml`, and the tool is in your catalog as `user__merged_prs`.

## Related guides

> **[Test a tool](/tools/guides/test-a-tool)**
>
> Run any tool directly and see what it returns.

> **[Tool file](/tools/reference/tool-file)**
>
> Every field a tool file takes.

> **[Create an agent in the workbench](/agents/guides/create-in-workbench)**
>
> Draft an agent that calls your tool.

> **[Draft a plan in the workbench](/plans/guides/draft-in-workbench)**
>
> Draft a plan that uses your tool.


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