{
  "openapi": "3.1.0",
  "info": {
    "title": "Toolrouter API",
    "description": "Toolrouter API for secure endpoint integration",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.toolrouter.ai"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Enter your Stack token"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/s/{client_id}/list_tools": {
      "get": {
        "description": "Returns all tools from the system that the user has access to",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "Client ID for authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "schema",
            "in": "query",
            "description": "Optional schema format (e.g., 'openai')",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of available tools",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tools": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Name of the tool"
                          },
                          "description": {
                            "type": "string",
                            "description": "Description of the tool's functionality"
                          },
                          "inputSchema": {
                            "type": "object",
                            "description": "JSON schema defining the tool's input parameters"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "response": {
                    "value": {
                      "tools": [
                        {
                          "name": "google-calendar_list_events",
                          "description": "List calendar events within a specified time range",
                          "inputSchema": {
                            "type": "object",
                            "properties": {
                              "timeMin": {
                                "type": "string",
                                "description": "Start time (ISO string)"
                              },
                              "timeMax": {
                                "type": "string",
                                "description": "End time (ISO string)"
                              },
                              "maxResults": {
                                "type": "number",
                                "description": "Maximum number of events to return"
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "error": {
                    "type": "string",
                    "description": "Error message"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "error": {
                    "type": "string",
                    "description": "Error message"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/s/{client_id}/call_tool": {
      "post": {
        "description": "Executes a specific tool with the provided parameters",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "Client ID for authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Tool execution details",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["tool_name", "tool_input"],
                "properties": {
                  "tool_name": {
                    "type": "string",
                    "description": "Name of the tool to execute"
                  },
                  "tool_input": {
                    "type": "object",
                    "description": "Parameters for the tool execution, structure depends on the specific tool"
                  }
                }
              },
              "examples": {
                "search": {
                  "value": {
                    "tool_name": "exa_search",
                    "tool_input": {
                      "query": "What is toolrouter AI ?"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool execution result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "description": "The result of the tool execution"
                    }
                  }
                },
                "examples": {
                  "response": {
                    "value": {
                      "result": {
                        "search_results": [
                          {
                            "title": "Toolrouter AI Platform",
                            "content": "Toolrouter is an AI integration platform that helps connect various tools and services securely.",
                            "url": "https://toolrouter.ai/about"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "error": {
                    "type": "string",
                    "description": "Error message"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "error": {
                    "type": "string",
                    "description": "Error message"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}