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

# Create Tool



## OpenAPI

````yaml POST /tool
openapi: 3.0.1
info:
  title: Clarion API
  description: >-
    Clarion's public facing API. For more information, please visit
    https://docs.clarionhealth.com
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.clarionhealth.com/v1
security:
  - bearerAuth: []
paths:
  /tool:
    post:
      summary: Create Tool
      operationId: ToolController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/CreateFunctionToolDTO'
                  title: FunctionTool
              discriminator:
                propertyName: type
                mapping:
                  function: '#/components/schemas/CreateFunctionToolDTO'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/FunctionTool'
                    title: FunctionTool
                discriminator:
                  propertyName: type
                  mapping:
                    function: '#/components/schemas/FunctionTool'
components:
  schemas:
    CreateFunctionToolDTO:
      type: object
      properties:
        async:
          type: boolean
          description: >-
            This determines if the tool is async.


            If async, the assistant will move forward without waiting for your
            server to respond. This is useful if you just want to trigger
            something on your server.


            If sync, the assistant will wait for your server to respond. This is
            useful if want assistant to respond with the result from your
            server.


            Defaults to synchronous (`false`).
          example: false
        type:
          type: string
          enum:
            - function
          description: The type of tool. "function" for Function tool.
        function:
          description: >-
            This is the function definition of the tool.


            For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled
            based on tool-specific fields like `tool.destinations`. But, even in
            those cases, you can provide a custom function definition for
            advanced use cases.


            An example of an advanced use case is if you want to customize the
            message that's spoken for `endCall` tool. You can specify a function
            where it returns an argument "reason". Then, in `messages` array,
            you can have many "request-complete" messages. One of these messages
            will be triggered if the `messages[].conditions` matches the
            "reason" argument.
          allOf:
            - $ref: '#/components/schemas/OpenAIFunction'
      required:
        - type
    FunctionTool:
      type: object
      properties:
        async:
          type: boolean
          description: >-
            This determines if the tool is async.


            If async, the assistant will move forward without waiting for your
            server to respond. This is useful if you just want to trigger
            something on your server.


            If sync, the assistant will wait for your server to respond. This is
            useful if want assistant to respond with the result from your
            server.


            Defaults to synchronous (`false`).
          example: false
        type:
          type: string
          enum:
            - function
          description: The type of tool. "function" for Function tool.
        id:
          type: string
          description: This is the unique identifier for the tool.
        orgId:
          type: string
          description: >-
            This is the unique identifier for the organization that this tool
            belongs to.
        createdAt:
          format: date-time
          type: string
          description: This is the ISO 8601 date-time string of when the tool was created.
        updatedAt:
          format: date-time
          type: string
          description: >-
            This is the ISO 8601 date-time string of when the tool was last
            updated.
        function:
          description: >-
            This is the function definition of the tool.


            For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled
            based on tool-specific fields like `tool.destinations`. But, even in
            those cases, you can provide a custom function definition for
            advanced use cases.


            An example of an advanced use case is if you want to customize the
            message that's spoken for `endCall` tool. You can specify a function
            where it returns an argument "reason". Then, in `messages` array,
            you can have many "request-complete" messages. One of these messages
            will be triggered if the `messages[].conditions` matches the
            "reason" argument.
          allOf:
            - $ref: '#/components/schemas/OpenAIFunction'
      required:
        - type
        - id
        - orgId
        - createdAt
        - updatedAt
    OpenAIFunction:
      type: object
      properties:
        strict:
          type: boolean
          description: >-
            This is a boolean that controls whether to enable strict schema
            adherence when generating the function call. If set to true, the
            model will follow the exact schema defined in the parameters field.
            Only a subset of JSON Schema is supported when strict is true. Learn
            more about Structured Outputs in the [OpenAI
            guide](https://openai.com/index/introducing-structured-outputs-in-the-api/).


            @default false
          default: false
        name:
          type: string
          description: >-
            This is the the name of the function to be called.


            Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a
            maximum length of 64.
          maxLength: 64
          pattern: /^[a-zA-Z0-9_-]{1,64}$/
        description:
          type: string
          description: >-
            This is the description of what the function does, used by the AI to
            choose when and how to call the function.
          maxLength: 1000
        parameters:
          description: >-
            These are the parameters the functions accepts, described as a JSON
            Schema object.


            See the [OpenAI
            guide](https://platform.openai.com/docs/guides/function-calling) for
            examples, and the [JSON Schema
            reference](https://json-schema.org/understanding-json-schema) for
            documentation about the format.


            Omitting parameters defines a function with an empty parameter list.
          allOf:
            - $ref: '#/components/schemas/OpenAIFunctionParameters'
      required:
        - name
    OpenAIFunctionParameters:
      type: object
      properties:
        type:
          type: string
          description: >-
            This must be set to 'object'. It instructs the model to return a
            JSON object containing the function call properties.
          enum:
            - object
        properties:
          type: object
          description: >-
            This provides a description of the properties required by the
            function.

            JSON Schema can be used to specify expectations for each property.

            Refer to [this
            doc](https://ajv.js.org/json-schema.html#json-data-type) for a
            comprehensive guide on JSON Schema.
          additionalProperties:
            $ref: '#/components/schemas/JsonSchema'
        required:
          description: This specifies the properties that are required by the function.
          type: array
          items:
            type: string
      required:
        - type
        - properties
    JsonSchema:
      type: object
      properties:
        type:
          type: string
          description: >-
            This is the type of output you'd like.


            `string`, `number`, `integer`, `boolean` are the primitive types and
            should be obvious.


            `array` and `object` are more interesting and quite powerful. They
            allow you to define nested structures.


            For `array`, you can define the schema of the items in the array
            using the `items` property.


            For `object`, you can define the properties of the object using the
            `properties` property.
          enum:
            - string
            - number
            - integer
            - boolean
            - array
            - object
        items:
          type: object
          description: >-
            This is required if the type is "array". This is the schema of the
            items in the array.


            This is of type JsonSchema. However, Swagger doesn't support
            circular references.
        properties:
          type: object
          description: >-
            This is required if the type is "object". This specifies the
            properties of the object.


            This is a map of string to JsonSchema. However, Swagger doesn't
            support circular references.
        description:
          type: string
          description: >-
            This is the description to help the model understand what it needs
            to output.
        required:
          description: |-
            This is a list of properties that are required.

            This only makes sense if the type is "object".
          type: array
          items:
            type: string
      required:
        - type
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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