# Validate the Name field for AI tools

**URL:** https://meta.discourse.org/t/validate-the-name-field-for-ai-tools/330830
**Category:** Bug
**Tags:** ai
**Created:** [October 14, 2024, 4:34pm UTC](https://meta.discourse.org/t/validate-the-name-field-for-ai-tools/330830 "2024-10-14T16:34:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [October 14, 2024, 4:34pm UTC](https://meta.discourse.org/t/validate-the-name-field-for-ai-tools/330830/1 "2024-10-14T16:34:27Z")

</div>

After creating a new tool in Discourse AI I came upon the following error:

```plaintext
Job exception: {
  "error": {
    "message": "Invalid 'tools[0].function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.",
    "type": "invalid_request_error",
    "param": "tools[0].function.name",
    "code": "invalid_value"
  }
}

```

I had spaces in the name, which I replaced with underscores to match the pattern. 👍

If that is expected, could we validate that field in the UI? We may also mention it in the descriptive text for that field.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 24, 2025, 5:04am UTC](https://meta.discourse.org/t/validate-the-name-field-for-ai-tools/330830/2 "2025-04-24T05:04:58Z")

</div>

Pretty sure we added a validation now, can you confirm?

---

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [April 24, 2025, 7:35pm UTC](https://meta.discourse.org/t/validate-the-name-field-for-ai-tools/330830/3 "2025-04-24T19:35:42Z")

</div>

![Screenshot 2025-04-24 at 12-34-35 Discourse AI - Plugins - Admin - fnord](https://global.discourse-cdn.com/meta/original/4X/3/d/4/3d40917ea7c4ee7518fe680e7e69640a28783444.png)

The Tool Name field is validating. 🎉

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 24, 2025, 8:30pm UTC](https://meta.discourse.org/t/validate-the-name-field-for-ai-tools/330830/4 "2025-04-24T20:30:29Z")

</div>


