Overview

Returns a list of all enabled tools from a specific stack. This endpoint supports multiple schema formats to match different AI framework requirements, including OpenAI and Anthropic formats.

Endpoint

GET https://api.toolrouter.ai/v1/stacks/{stack_id}/tools

Authentication

This endpoint requires an API key. Include it in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Path Parameters

stack_id
string
required

The unique identifier of the stack to get tools from

Query Parameters

schema
string
default:"default"

The schema format for the returned tools

Response

tools
array

Array of tool objects formatted according to the specified schema

Example Request

Default Format

curl -X GET "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000/tools" \
  -H "Authorization: Bearer YOUR_API_KEY"

OpenAI Format

curl -X GET "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000/tools?schema=openai" \
  -H "Authorization: Bearer YOUR_API_KEY"

Anthropic Format

curl -X GET "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000/tools?schema=anthropic" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Responses

Default Format

{
  "tools": [
    {
      "name": "gmail_send_email",
      "description": "Send an email through Gmail",
      "input_schema": {
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {"type": "string"},
            "description": "List of recipient email addresses"
          },
          "subject": {
            "type": "string",
            "description": "Email subject"
          },
          "body": {
            "type": "string",
            "description": "Email body content"
          }
        },
        "required": ["to", "subject", "body"]
      },
      "server": "gmail"
    },
    {
      "name": "linear_create_issue",
      "description": "Create a new issue in Linear",
      "input_schema": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Issue title"
          },
          "description": {
            "type": "string",
            "description": "Issue description"
          },
          "teamId": {
            "type": "string",
            "description": "Team ID"
          }
        },
        "required": ["title", "teamId"]
      },
      "server": "linear"
    }
  ]
}

OpenAI Format

{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "gmail_send_email",
        "description": "Send an email through Gmail",
        "parameters": {
          "type": "object",
          "properties": {
            "to": {
              "type": "array",
              "items": {"type": "string"},
              "description": "List of recipient email addresses"
            },
            "subject": {
              "type": "string",
              "description": "Email subject"
            },
            "body": {
              "type": "string",
              "description": "Email body content"
            }
          },
          "required": ["to", "subject", "body"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "linear_create_issue",
        "description": "Create a new issue in Linear",
        "parameters": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "description": "Issue title"
            },
            "description": {
              "type": "string",
              "description": "Issue description"
            },
            "teamId": {
              "type": "string",
              "description": "Team ID"
            }
          },
          "required": ["title", "teamId"]
        }
      }
    }
  ]
}

Anthropic Format

{
  "tools": [
    {
      "name": "gmail_send_email",
      "description": "Send an email through Gmail",
      "input_schema": {
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {"type": "string"},
            "description": "List of recipient email addresses"
          },
          "subject": {
            "type": "string",
            "description": "Email subject"
          },
          "body": {
            "type": "string",
            "description": "Email body content"
          }
        },
        "required": ["to", "subject", "body"]
      }
    },
    {
      "name": "linear_create_issue",
      "description": "Create a new issue in Linear",
      "input_schema": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Issue title"
          },
          "description": {
            "type": "string",
            "description": "Issue description"
          },
          "teamId": {
            "type": "string",
            "description": "Team ID"
          }
        },
        "required": ["title", "teamId"]
      }
    }
  ]
}

Integration Examples

Using with OpenAI

import openai
import requests

# Get tools in OpenAI format
headers = {"Authorization": "Bearer YOUR_API_KEY"}
tools_response = requests.get(
    "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000/tools?schema=openai",
    headers=headers
)
tools = tools_response.json()["tools"]

# Use with OpenAI chat completions
response = openai.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Send an email to john@example.com"}],
    tools=tools
)

Using with Anthropic

import anthropic
import requests

# Get tools in Anthropic format
headers = {"Authorization": "Bearer YOUR_API_KEY"}
tools_response = requests.get(
    "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000/tools?schema=anthropic",
    headers=headers
)
tools = tools_response.json()["tools"]

# Use with Anthropic API
client = anthropic.Anthropic()
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "Send an email to john@example.com"}]
)

Use Cases

  • AI Integration: Get tools in the format needed for your AI framework
  • Dynamic Tool Discovery: Programmatically discover available tools in a stack
  • Application Setup: Configure your application with the tools available in a stack
  • Documentation Generation: Generate tool documentation for your applications

Error Responses

401 Unauthorized

Invalid or missing API key

{
  "detail": "Unauthorized"
}
404 Not Found

Stack not found

{
  "detail": "Stack not found"
}
429 Too Many Requests

Rate limit exceeded

{
  "detail": "Too many requests"
}
500 Internal Server Error

Server error occurred

{
  "detail": "Failed to get tools"
}