Skip to main content
POST
/
api
/
v1
/
tools
Python (SDK)
import os
from syllable_sdk import SyllableSDK, models


with SyllableSDK(
    api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:

    res = ss_client.tools.create(request=models.ToolCreateRequest(
        name="Weather Fetcher",
        definition=models.ToolDefinition(
            type=models.ToolDefinitionType.ENDPOINT,
            tool=models.InternalTool(
                function=models.ToolFunction(
                    name="get_weather",
                    description="Get the weather for a city",
                    parameters={

                    },
                ),
            ),
            endpoint=models.ToolHTTPEndpoint(
                url="https://api.example.com",
                method=models.ToolHTTPMethod.DELETE,
                argument_location=models.ToolArgumentLocation.PATH,
            ),
            defaults="<value>",
            static_parameters=[
                models.StaticToolParameter(
                    name="temperature_unit",
                    description="Whether the temperature information should be fetched in Celsius or Fahrenheit",
                    required=False,
                    type=models.StaticToolParameterType.STRING,
                    default="fahrenheit",
                ),
            ],
        ),
        service_id=1,
    ))

    # Handle response
    print(res)
{
  "name": "<string>",
  "definition": {
    "tool": {
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": "<unknown>"
      },
      "type": "function"
    },
    "type": "endpoint",
    "endpoint": {
      "url": "<string>",
      "method": "get",
      "argument_location": "body"
    },
    "context": {
      "task": {
        "id": "<string>",
        "config": {},
        "variables": [
          {
            "name": "<string>",
            "value": "<unknown>",
            "value_from": {
              "expression": "<string>",
              "type": "cel"
            },
            "type": "string",
            "description": "<string>",
            "title": "<string>",
            "format": "<string>",
            "pattern": "<string>",
            "enum": [
              "<string>"
            ],
            "examples": [
              "<unknown>"
            ]
          }
        ],
        "metadata": {
          "priority": 123,
          "parent_tool_name": "<string>"
        },
        "tool": {
          "name": "<string>",
          "description": "<string>"
        },
        "type": "expression",
        "version": "v1alpha",
        "inputs": [
          {
            "name": "<string>",
            "type": "string",
            "description": "<string>",
            "title": "<string>",
            "format": "<string>",
            "pattern": "<string>",
            "enum": [
              "<string>"
            ],
            "examples": [
              "<unknown>"
            ],
            "required": true
          }
        ],
        "expression": {
          "expression": "<string>",
          "type": "cel"
        },
        "output": "<unknown>",
        "on": {
          "start": [
            {
              "name": "<string>",
              "value": "<unknown>",
              "value_from": {
                "expression": "<string>",
                "type": "cel"
              },
              "if": {
                "expression": "<string>",
                "type": "cel"
              },
              "action": "set"
            }
          ],
          "submit": [
            {
              "name": "<string>",
              "value": "<unknown>",
              "value_from": {
                "expression": "<string>",
                "type": "cel"
              },
              "if": {
                "expression": "<string>",
                "type": "cel"
              },
              "action": "set"
            }
          ]
        }
      }
    },
    "defaults": "<unknown>",
    "static_parameters": [
      {
        "default": "fahrenheit",
        "description": "Whether the temperature information should be fetched in Celsius or Fahrenheit",
        "name": "temperature_unit",
        "required": false,
        "type": "string"
      }
    ],
    "result": "<unknown>",
    "options": {
      "propagate_tool_result": false
    }
  },
  "service_id": 123,
  "id": 123,
  "last_updated": "2023-11-07T05:31:56Z",
  "last_updated_by": "<string>",
  "last_updated_comments": "Updated to use new API endpoint",
  "service_name": "<string>",
  "prompts_info": [
    {
      "id": 123,
      "name": "<string>"
    }
  ],
  "agents_info": [
    {
      "id": 123,
      "name": "<string>"
    }
  ]
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json

Request model to create a tool.

name
string
required

The name of the tool

definition
ToolDefinition · object
required

The definition of the tool

service_id
integer
required

Internal ID of the service to which the tool belongs

Response

Successful Response

Response model for tool operations. A tool is a function that an agent can call to perform actions like accessing databases, making API calls, or processing data. For an agent to have access to a tool, the prompt associated with that agent should be linked to the tool and include instructions to use it. For more information, see Console docs.

name
string
required

The name of the tool

definition
ToolDefinition · object
required

The definition of the tool

service_id
integer
required

Internal ID of the service to which the tool belongs

id
integer
required

The internal ID of the tool

last_updated
string<date-time>
required

The timestamp of the most recent update to the tool

last_updated_by
string
required

The email of the user who last updated the tool

last_updated_comments
string | null

Comments for the most recent edit to the tool.

Example:

"Updated to use new API endpoint"

service_name
string | null

The name of the service to which the tool belongs

prompts_info
ToolPromptInfo · object[] | null

IDs and names of the prompts linked to the tool

agents_info
ToolAgentInfo · object[] | null

IDs and names of the agents linked to the tool via a prompt