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

# Search teams

> MCP tool to search for teams using Thena's search API with advanced filtering capabilities.

import Admonition from '@theme/Admonition';

### MCP tool: `search_teams`

Searches for teams using Thena's powerful search API with advanced filtering capabilities. This tool allows you to find teams based on various criteria including name, team UID, and other team properties.

<Admonition type="note">
  This tool uses Thena's search API which provides fast, indexed search with support for complex filters and pagination.
</Admonition>

### Example prompt

```prompt theme={null}
Search for teams with "we" in their name
```

<Admonition type="info">
  When you use this prompt in a chat with the model (with the MCP tool registered), the model will automatically call the <code>search\_teams</code> tool with the correct arguments.
</Admonition>

### Response fields

The response will contain a `result` object with the following structure:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>found</td><td>number</td><td>Total number of teams found</td></tr>
    <tr><td>hits</td><td>array</td><td>Array of team objects matching the search criteria</td></tr>
    <tr><td>page</td><td>number</td><td>Current page number</td></tr>
    <tr><td>facet\_counts</td><td>array</td><td>Facet counts for search results</td></tr>
    <tr><td>request\_params</td><td>object</td><td>Parameters used for the search request</td></tr>
    <tr><td>search\_cutoff</td><td>boolean</td><td>Whether the search was cut off due to limits</td></tr>
  </tbody>
</table>

#### Team object fields

Each team in the `hits` array contains a `document` object with the following fields:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>id</td><td>string</td><td>Team unique identifier</td></tr>
    <tr><td>name</td><td>string</td><td>Team name</td></tr>
    <tr><td>icon</td><td>string</td><td>Team icon</td></tr>
    <tr><td>color</td><td>string</td><td>Team color (RGB format)</td></tr>
    <tr><td>identifier</td><td>string</td><td>Team identifier/code</td></tr>
    <tr><td>description</td><td>string</td><td>Team description</td></tr>
    <tr><td>teamOwner</td><td>string</td><td>Team owner name</td></tr>
    <tr><td>teamOwnerId</td><td>string</td><td>Team owner ID</td></tr>
    <tr><td>isActive</td><td>boolean</td><td>Whether the team is active</td></tr>
    <tr><td>isPrivate</td><td>boolean</td><td>Whether the team is private</td></tr>
    <tr><td>createdAt</td><td>string (ISO8601)</td><td>Team creation timestamp</td></tr>
    <tr><td>updatedAt</td><td>string (ISO8601)</td><td>Last update timestamp</td></tr>
    <tr><td>ticketTypes</td><td>array</td><td>Available ticket types for this team</td></tr>
    <tr><td>tags</td><td>array</td><td>Team tags</td></tr>
    <tr><td>priorities</td><td>array</td><td>Available ticket priorities</td></tr>
    <tr><td>sentiments</td><td>array</td><td>Available ticket sentiments</td></tr>
    <tr><td>statuses</td><td>array</td><td>Available ticket statuses</td></tr>
    <tr><td>forms</td><td>array</td><td>Team forms</td></tr>
    <tr><td>subTeams</td><td>array</td><td>Sub-teams</td></tr>
    <tr><td>ticketFields</td><td>array</td><td>Custom ticket fields</td></tr>
    <tr><td>isDefaultTeam</td><td>boolean</td><td>Whether this is the default team</td></tr>
    <tr><td>ticketSources</td><td>array</td><td>Available ticket sources</td></tr>
  </tbody>
</table>

#### Nested object fields

**Ticket Types:**

* `id`: Ticket type ID
* `name`: Ticket type name
* `icon`: Ticket type icon
* `color`: Ticket type color
* `autoAssign`: Whether tickets auto-assign

**Priorities:**

* `id`: Priority ID
* `name`: Priority name
* `description`: Priority description
* `isDefault`: Whether this is the default priority

**Sentiments:**

* `id`: Sentiment ID
* `name`: Sentiment name
* `isDefault`: Whether this is the default sentiment

**Statuses:**

* `id`: Status ID
* `name`: Status name
* `description`: Status description
* `isDefault`: Whether this is the default status

**Forms:**

* `id`: Form ID
* `name`: Form name
* `description`: Form description
* `fields`: Array of form fields

**Ticket Sources:**

* `label`: Source label
* `value`: Source value

### Sample response

```json theme={null}
{
  "result": {
    "found": 1,
    "hits": [
      {
        "document": {
          "id": "THETT4QZZD9PPM",
          "name": "wed",
          "icon": "",
          "color": "rgb(155, 135, 245)",
          "identifier": "WED",
          "description": null,
          "teamOwner": "shakthi+1",
          "teamOwnerId": "UTH00SEXXFNVVN",
          "isActive": true,
          "isPrivate": false,
          "createdAt": "2025-07-09T09:17:14.954Z",
          "updatedAt": "2025-07-09T09:17:14.954Z",
          "ticketTypes": [
            {
              "id": "9W5K7QZJ10DG45E7T1FJHHF2MM32P",
              "name": "Bug",
              "icon": "",
              "color": "#db1f61",
              "autoAssign": true
            },
            {
              "id": "MW5K7QZJ106FT03R2JKSBDD9DTGQZ",
              "name": "Feature Request",
              "icon": "",
              "color": "#1f74db",
              "autoAssign": true
            },
            {
              "id": "MW5K7QZJ1068644FX44KR04C6801D",
              "name": "Question",
              "icon": "",
              "color": "#1fdb8a",
              "autoAssign": true
            },
            {
              "id": "MW5K7QZJ10QHFEJQWXBJHYPG146C3",
              "name": "Task",
              "icon": "",
              "color": "#db7a1f",
              "autoAssign": true
            }
          ],
          "tags": [],
          "priorities": [
            {
              "id": "WQ5K7QZJ102C4JKG6XE01M2G3HEAQ",
              "name": "Low",
              "description": "Low priority tickets.",
              "isDefault": false
            },
            {
              "id": "GR5K7QZJ10H0300NBSAPN5CG4TN9F",
              "name": "Medium",
              "description": "Medium priority tickets.",
              "isDefault": true
            },
            {
              "id": "GR5K7QZJ105KWTPW1AG052HBVAPNF",
              "name": "High",
              "description": "High priority tickets.",
              "isDefault": false
            },
            {
              "id": "GR5K7QZJ10RPP1CQV6KG57SM7M75E",
              "name": "Urgent",
              "description": "Urgent priority tickets.",
              "isDefault": false
            }
          ],
          "sentiments": [
            {
              "id": "4T5K7QZJ10MR5QR6KZZ43M5G3YKPH",
              "name": "Positive",
              "isDefault": false
            },
            {
              "id": "JT5K7QZJ1047VQT6M06TMANM3D9TQ",
              "name": "Negative",
              "isDefault": false
            },
            {
              "id": "JT5K7QZJ107BR5DAKC2HBC4G3NA5A",
              "name": "Neutral",
              "isDefault": true
            }
          ],
          "statuses": [
            {
              "id": "TN5K7QZJ10AXB995EXD07ZSXBYPM4",
              "name": "In progress",
              "description": "Tickets that are currently in progress and being worked on.",
              "isDefault": false
            },
            {
              "id": "VN5K7QZJ10CJK5E47S8TQSA19XCXA",
              "name": "On hold",
              "description": "Tickets that are currently on hold.",
              "isDefault": false
            },
            {
              "id": "VN5K7QZJ1042MM6W6DF59ZZAK5DTP",
              "name": "Closed",
              "description": "Tickets that are closed or resolved.",
              "isDefault": false
            },
            {
              "id": "YM5K7QZJ10NPP6GZXZTR1C2DB9AG3",
              "name": "Open",
              "description": "Tickets that are open and awaiting prioritization.",
              "isDefault": true
            }
          ],
          "forms": [
            {
              "id": "FODDKPKKXW88L",
              "name": "Default team form",
              "description": "Default form for the team",
              "fields": [
                {
                  "field": "NMW047ZJ10RJHW0W5DB19SEM5W75A",
                  "fieldType": "thena_restricted",
                  "defaultValue": null,
                  "mandatoryOnClose": true,
                  "visibleToCustomer": true,
                  "editableByCustomer": true,
                  "mandatoryOnCreation": true
                },
                {
                  "field": "NMW047ZJ109W62PM4FR82YG58KXTN",
                  "fieldType": "thena_restricted",
                  "defaultValue": null,
                  "mandatoryOnClose": true,
                  "visibleToCustomer": true,
                  "editableByCustomer": true,
                  "mandatoryOnCreation": true
                },
                {
                  "field": "NMW047ZJ10D2JAMZRM4TGPMVYYG2K",
                  "fieldType": "thena_restricted",
                  "defaultValue": null,
                  "mandatoryOnClose": true,
                  "visibleToCustomer": true,
                  "editableByCustomer": true,
                  "mandatoryOnCreation": true
                }
              ]
            },
            {
              "id": "FOCCGUHH8GEE4",
              "name": "Default team escalation form",
              "description": "Default escalation form for the team",
              "fields": [
                {
                  "field": "3PW047ZJ105ENAGR1BT2NM5PG3ZM5",
                  "fieldType": "thena_restricted",
                  "defaultValue": null,
                  "mandatoryOnClose": false,
                  "visibleToCustomer": false,
                  "editableByCustomer": true,
                  "mandatoryOnCreation": true
                }
              ]
            }
          ],
          "subTeams": [],
          "ticketFields": [],
          "isDefaultTeam": true,
          "ticketSources": [
            {
              "label": "Api",
              "value": "api"
            },
            {
              "label": "Manual",
              "value": "manual"
            },
            {
              "label": "Web",
              "value": "web"
            }
          ]
        }
      }
    ],
    "page": 1,
    "facet_counts": [],
    "request_params": {
      "search_mode": "fallback",
      "q": "*",
      "query_by": "*",
      "filter_by": "name:=we"
    },
    "search_cutoff": false
  }
}
```

<Admonition type="tip">
  Always pass an object as input, even if empty, to avoid errors when calling the tool directly.
</Admonition>

<Admonition type="info">
  The search API provides fast, indexed search results. Use specific filters to narrow down results and improve performance.
</Admonition>

<Admonition type="warning">
  Only the core team fields (name, teamUid, uid) support direct text search. Other fields require exact value matching.
</Admonition>

***

### Notes

* Only authorized users can access this tool; results are scoped to the user's organization.
* The search API supports full-text search on team names using ILike pattern matching.
* Team UID searches require exact matches.
* Filters can be combined using AND or OR logic for complex queries.
* Boolean filters use true/false values.
* The search is case-insensitive for text fields.
* Results are paginated with a maximum of 250 items per page.
* Use the `range` operator for date ranges (e.g., "\[2024-01-01..2024-12-31]").
