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

# Test tool execution

> Tests a tool by executing it with the provided parameters. This allows you
to verify that your webhook is configured correctly and returns the expected
response. You can also use `validate_only` to test parameter validation
without actually calling the webhook.

## Use Cases
- Verify webhook configuration
- Debug failed tool calls
- Test parameter validation
- Develop and iterate on webhooks




## OpenAPI

````yaml post /tool/{id}/test
openapi: 3.0.3
info:
  title: iwy API
  description: >
    API for managing AI agents and custom tools. Create conversational AI agents
    with custom capabilities,

    manage tool integrations, and embed AI avatars in your applications.


    ## Authentication

    All endpoints require authentication using a Bearer token
    (IWY_SERVICE_API_KEY).

    You can find your API key at
    [app.iwy.ai/settings](https://app.iwy.ai/settings).


    ## Base URL

    ```

    https://api.iwy.ai/v1

    ```
  version: 1.0.0
  contact:
    name: iwy Support
    url: https://www.iwy.ai/contact
servers:
  - url: https://api.iwy.ai/v1
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Ephemeral Agents
    description: Create one-time use agents with automatic expiration
  - name: Agents
    description: Manage AI agents and their configurations
  - name: Tools
    description: Manage custom tools and functions for agents
  - name: Sessions
    description: Start and manage agent video call sessions
paths:
  /tool/{id}/test:
    post:
      tags:
        - Tools
      summary: Test tool execution
      description: >
        Tests a tool by executing it with the provided parameters. This allows
        you

        to verify that your webhook is configured correctly and returns the
        expected

        response. You can also use `validate_only` to test parameter validation

        without actually calling the webhook.


        ## Use Cases

        - Verify webhook configuration

        - Debug failed tool calls

        - Test parameter validation

        - Develop and iterate on webhooks
      operationId: testTool
      parameters:
        - $ref: '#/components/parameters/ToolId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestToolRequest'
            examples:
              full_test:
                summary: Full execution test
                value:
                  parameters:
                    city: Paris
              validate_only:
                summary: Validation only (no webhook call)
                value:
                  parameters:
                    city: Paris
                  validate_only: true
      responses:
        '200':
          description: Tool test executed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestToolResponse'
              examples:
                success:
                  summary: Successful test execution
                  value:
                    success: true
                    execution_time_ms: 1234
                    tool:
                      id: dcfae097-1b37-4444-bb0c-1a6abb0320fd
                      name: get_weather
                    request_sent:
                      url: https://webhook.example.com/weather
                      method: POST
                      headers:
                        Content-Type: application/json
                        x-api-key: '[REDACTED]'
                      payload:
                        tool_id: dcfae097-1b37-4444-bb0c-1a6abb0320fd
                        tool_name: get_weather
                        parameters:
                          city: Paris
                    response_received:
                      status: 200
                      status_text: OK
                      headers:
                        content-type: application/json
                        content-length: '256'
                      body:
                        temperature: 18
                        conditions: Partly cloudy
                        humidity: 65
                      content_type: application/json
                validation_only:
                  summary: Validation only response
                  value:
                    success: true
                    validation: passed
                    message: Parameters are valid according to the tool schema
        '400':
          description: Parameter validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: Parameter validation failed
                details:
                  missing_required:
                    - city
                  invalid_params:
                    units: 'Must be one of: celsius, fahrenheit'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '408':
          description: Request timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: Request timeout
                execution_time_ms: 20000
                details: Request exceeded 20s timeout
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          description: Network error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: Network error
                execution_time_ms: 1567
                details: getaddrinfo ENOTFOUND webhook.example.com
components:
  parameters:
    ToolId:
      name: id
      in: path
      required: true
      description: The unique identifier (UUID) of the tool
      schema:
        type: string
        format: uuid
      example: dcfae097-1b37-4444-bb0c-1a6abb0320fd
  schemas:
    TestToolRequest:
      type: object
      required:
        - parameters
      properties:
        parameters:
          type: object
          description: Parameters to pass to the tool
          additionalProperties: true
          example:
            city: Paris
        validate_only:
          type: boolean
          description: Only validate parameters without calling webhook
          default: false
    TestToolResponse:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          description: Whether the test was successful
        execution_time_ms:
          type: integer
          description: Execution time in milliseconds
        validation:
          type: string
          description: Validation status (for validate_only requests)
        message:
          type: string
          description: Human-readable message
        tool:
          type: object
          description: Tool information
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
        request_sent:
          type: object
          description: Details of the request sent to webhook
          properties:
            url:
              type: string
            method:
              type: string
            headers:
              type: object
              additionalProperties: true
            payload:
              type: object
        response_received:
          type: object
          description: Response from the webhook
          properties:
            status:
              type: integer
            status_text:
              type: string
            headers:
              type: object
              additionalProperties: true
            body:
              type: object
            content_type:
              type: string
    Error:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: Error message
          example: Parameter validation failed
        details:
          description: Additional error details
          oneOf:
            - type: string
            - type: object
        execution_time_ms:
          type: integer
          description: Execution time before error occurred
  responses:
    UnauthorizedError:
      description: Authentication failed - invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Unauthorized
            details: Invalid or missing API key
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Not found
            details: The requested resource does not exist
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Internal server error
            details: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Your iwy Service API Key. Find it at
        [app.iwy.ai/settings](https://app.iwy.ai/settings).


        Include it in the Authorization header:

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````