# agent: Simplify tool schemas for enums \(\#55763\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/9955c4579d54c168a9e7a54b41ae78f83582a5a0)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 9955c4579d54c168a9e7a54b41ae78f83582a5a0

Requested commit: 9955c4579d54c168a9e7a54b41ae78f83582a5a0

Commit: 9955c4579d54c168a9e7a54b41ae78f83582a5a0

Tree: 7aaaf5b450002df4c36664faeb77d81d8870ec63

Author: Bennet Bo Fenner

Committer: GitHub

## Message

````
agent: Simplify tool schemas for enums (#55763)

Previously schemars generated oneOf variants for these enums (because we
added inline comments), making the schemas more complicated than they
had to be.

E.g. `edit_file` `mode`

Before:
```json
{
  "mode": {
    "description": "The mode of operation on the file. Possible values:\n- 'write': Replace the entire contents of the file. If the file doesn't exist, it will be created. Requires 'content' field.\n- 'edit': Make granular edits to an existing file. Requires 'edits' field.\n\nWhen a file already exists or you just created it, prefer editing it as opposed to recreating it from scratch.",
    "oneOf": [
      {
        "description": "Overwrite the file with new content (replacing any existing content).\nIf the file does not exist, it will be created.",
        "type": "string",
        "const": "write"
      },
      {
        "description": "Make granular edits to an existing file",
        "type": "string",
        "const": "edit"
      }
    ]
  }
}
```

After:
```json
{
  "mode": {
    "description": "The mode of operation on the file. Possible values:\n- 'write': Replace the entire contents of the file. If the file doesn't exist, it will be created. Requires 'content' field.\n- 'edit': Make granular edits to an existing file. Requires 'edits' field.\n\nWhen a file already exists or you just created it, prefer editing it as opposed to recreating it from scratch.",
    "type": "string",
    "enum": ["write", "edit"]
  }
}
```

Release Notes:

- N/A
````

## Parents

- [b4a96f9c147d605bc7a3f30e9b37d0d257040e97](https://git.cafe/gitcafe/zed/commit/b4a96f9c147d605bc7a3f30e9b37d0d257040e97?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/9955c4579d54c168a9e7a54b41ae78f83582a5a0?format=markdown)
