Skip to content

Custom Tool Examples

This page provides practical examples of custom tools for various use cases. You can use these examples as templates for building your own custom tools.

CRM Integration Tool

This example demonstrates a tool for integrating with a CRM system:

json
{
  "name": "CRMTool",
  "label": "CRM Integration",
  "actions": [
    {
      "name": "getCustomer",
      "description": "Retrieve customer information from the CRM system",
      "displayName": "Get Customer Information",
      "api": {
        "url": "https://api.example.com/crm/v1/customers",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string",
            "description": "Unique identifier of the customer",
            "required": false
          },
          "email": {
            "type": "string",
            "description": "Email address of the customer",
            "required": false,
            "format": "email"
          },
          "phone": {
            "type": "string",
            "description": "Phone number of the customer",
            "required": false
          }
        }
      }
    },
    {
      "name": "createCustomer",
      "description": "Create a new customer record in the CRM system",
      "displayName": "Create Customer",
      "api": {
        "url": "https://api.example.com/crm/v1/customers",
        "method": "POST",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Full name of the customer",
            "required": true
          },
          "email": {
            "type": "string",
            "description": "Email address of the customer",
            "required": true,
            "format": "email"
          },
          "phone": {
            "type": "string",
            "description": "Phone number of the customer",
            "required": true
          },
          "companyName": {
            "type": "string",
            "description": "Company name of the customer",
            "required": false
          },
          "source": {
            "type": "string",
            "description": "Source of the customer lead",
            "required": false,
            "enum": ["website", "referral", "advertisement", "direct", "other"]
          }
        }
      }
    },
    {
      "name": "updateCustomer",
      "description": "Update an existing customer record in the CRM system",
      "displayName": "Update Customer",
      "api": {
        "url": "https://api.example.com/crm/v1/customers/${customerId}",
        "method": "PUT",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string",
            "description": "Unique identifier of the customer to update",
            "required": true
          },
          "name": {
            "type": "string",
            "description": "Full name of the customer",
            "required": false
          },
          "email": {
            "type": "string",
            "description": "Email address of the customer",
            "required": false,
            "format": "email"
          },
          "phone": {
            "type": "string",
            "description": "Phone number of the customer",
            "required": false
          },
          "companyName": {
            "type": "string",
            "description": "Company name of the customer",
            "required": false
          }
        }
      }
    }
  ]
}

E-commerce Product Tool

This example shows a tool for retrieving product information from an e-commerce system:

json
{
  "name": "ProductTool",
  "label": "Product Information",
  "actions": [
    {
      "name": "searchProducts",
      "description": "Search for products based on various criteria",
      "displayName": "Search Products",
      "api": {
        "url": "https://api.example.com/products/search",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Search term for finding products",
            "required": false
          },
          "category": {
            "type": "string",
            "description": "Product category",
            "required": false
          },
          "minPrice": {
            "type": "number",
            "description": "Minimum price filter",
            "required": false,
            "minimum": 0
          },
          "maxPrice": {
            "type": "number",
            "description": "Maximum price filter",
            "required": false,
            "minimum": 0
          },
          "inStock": {
            "type": "boolean",
            "description": "Filter for products that are in stock",
            "required": false,
            "default": true
          },
          "limit": {
            "type": "number",
            "description": "Maximum number of results to return",
            "required": false,
            "default": 10,
            "maximum": 50
          }
        }
      }
    },
    {
      "name": "getProductDetails",
      "description": "Get detailed information about a specific product",
      "displayName": "Get Product Details",
      "api": {
        "url": "https://api.example.com/products/${productId}",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "description": "Unique identifier of the product",
            "required": true
          }
        }
      }
    },
    {
      "name": "checkInventory",
      "description": "Check current inventory levels for a product",
      "displayName": "Check Inventory",
      "api": {
        "url": "https://api.example.com/products/${productId}/inventory",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "description": "Unique identifier of the product",
            "required": true
          },
          "locationId": {
            "type": "string",
            "description": "Specific store or warehouse location ID",
            "required": false
          }
        }
      }
    }
  ]
}

Calendar Scheduling Tool

This example demonstrates a tool for managing calendar appointments:

json
{
  "name": "CalendarTool",
  "label": "Calendar Management",
  "actions": [
    {
      "name": "getAvailability",
      "description": "Check available time slots for scheduling",
      "displayName": "Check Availability",
      "api": {
        "url": "https://api.example.com/calendar/availability",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "Date to check availability (YYYY-MM-DD)",
            "required": true,
            "format": "date"
          },
          "duration": {
            "type": "number",
            "description": "Appointment duration in minutes",
            "required": false,
            "default": 30
          },
          "resourceId": {
            "type": "string",
            "description": "ID of the resource (person, room, etc.) to check",
            "required": false
          }
        }
      }
    },
    {
      "name": "createAppointment",
      "description": "Schedule a new appointment",
      "displayName": "Create Appointment",
      "api": {
        "url": "https://api.example.com/calendar/appointments",
        "method": "POST",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Title of the appointment",
            "required": true
          },
          "startDateTime": {
            "type": "string",
            "description": "Start date and time (ISO format: YYYY-MM-DDTHH:MM:SS)",
            "required": true,
            "format": "date-time"
          },
          "endDateTime": {
            "type": "string",
            "description": "End date and time (ISO format: YYYY-MM-DDTHH:MM:SS)",
            "required": true,
            "format": "date-time"
          },
          "attendees": {
            "type": "array",
            "description": "List of attendees",
            "required": false,
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "description": "Email address of attendee",
                  "required": true,
                  "format": "email"
                },
                "name": {
                  "type": "string",
                  "description": "Name of attendee",
                  "required": false
                }
              }
            }
          },
          "location": {
            "type": "string",
            "description": "Location of the appointment",
            "required": false
          },
          "description": {
            "type": "string",
            "description": "Detailed description of the appointment",
            "required": false
          }
        }
      }
    }
  ]
}

Knowledge Base Tool

This example shows a tool for querying an internal knowledge base:

json
{
  "name": "KnowledgeBaseTool",
  "label": "Knowledge Base Search",
  "actions": [
    {
      "name": "searchArticles",
      "description": "Search for articles in the knowledge base",
      "displayName": "Search Knowledge Base",
      "api": {
        "url": "https://api.example.com/kb/search",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Search terms to find relevant articles",
            "required": true
          },
          "category": {
            "type": "string",
            "description": "Category to filter by",
            "required": false
          },
          "limit": {
            "type": "number",
            "description": "Maximum number of results to return",
            "required": false,
            "default": 5,
            "maximum": 20
          }
        }
      }
    },
    {
      "name": "getArticle",
      "description": "Get the full content of a specific knowledge base article",
      "displayName": "Get Article Content",
      "api": {
        "url": "https://api.example.com/kb/articles/${articleId}",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "articleId": {
            "type": "string",
            "description": "Unique identifier of the article",
            "required": true
          }
        }
      }
    }
  ]
}

Ticket Management Tool

This example demonstrates a tool for managing support tickets:

json
{
  "name": "TicketTool",
  "label": "Support Ticket Management",
  "actions": [
    {
      "name": "createTicket",
      "description": "Create a new support ticket",
      "displayName": "Create Support Ticket",
      "api": {
        "url": "https://api.example.com/support/tickets",
        "method": "POST",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "description": "Subject line of the ticket",
            "required": true
          },
          "description": {
            "type": "string",
            "description": "Detailed description of the issue",
            "required": true
          },
          "priority": {
            "type": "string",
            "description": "Priority level of the ticket",
            "required": false,
            "enum": ["low", "medium", "high", "critical"],
            "default": "medium"
          },
          "category": {
            "type": "string",
            "description": "Category of the issue",
            "required": false
          },
          "customerEmail": {
            "type": "string",
            "description": "Email address of the customer",
            "required": true,
            "format": "email"
          }
        }
      }
    },
    {
      "name": "getTicketStatus",
      "description": "Check the status of an existing ticket",
      "displayName": "Check Ticket Status",
      "api": {
        "url": "https://api.example.com/support/tickets/${ticketId}",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "ticketId": {
            "type": "string",
            "description": "Unique identifier of the ticket",
            "required": true
          }
        }
      }
    },
    {
      "name": "updateTicket",
      "description": "Update an existing support ticket",
      "displayName": "Update Ticket",
      "api": {
        "url": "https://api.example.com/support/tickets/${ticketId}",
        "method": "PUT",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "ticketId": {
            "type": "string",
            "description": "Unique identifier of the ticket to update",
            "required": true
          },
          "status": {
            "type": "string",
            "description": "New status of the ticket",
            "required": false,
            "enum": ["open", "in_progress", "pending", "resolved", "closed"]
          },
          "comment": {
            "type": "string",
            "description": "Comment to add to the ticket history",
            "required": false
          },
          "assignee": {
            "type": "string",
            "description": "Email of the staff member to assign the ticket to",
            "required": false,
            "format": "email"
          }
        }
      }
    }
  ]
}

.NET Web API Integration Tool

This example demonstrates a tool for integrating with a .NET Web API:

json
{
  "name": "DotNetTool",
  "label": ".NET Integration",
  "actions": [
    {
      "name": "getUserData",
      "description": "Retrieve user information from the .NET API",
      "displayName": "Get User Data",
      "api": {
        "url": "https://api.example.com/users",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "description": "Unique identifier of the user",
            "required": true
          },
          "includeDetails": {
            "type": "boolean",
            "description": "Whether to include detailed user information",
            "required": false,
            "default": false
          }
        }
      }
    },
    {
      "name": "createUser",
      "description": "Create a new user in the system",
      "displayName": "Create User",
      "api": {
        "url": "https://api.example.com/users",
        "method": "POST",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "description": "Username for the new user",
            "required": true
          },
          "email": {
            "type": "string",
            "description": "Email address of the user",
            "required": true,
            "format": "email"
          },
          "firstName": {
            "type": "string",
            "description": "First name of the user",
            "required": true
          },
          "lastName": {
            "type": "string",
            "description": "Last name of the user",
            "required": true
          },
          "role": {
            "type": "string",
            "description": "User role in the system",
            "required": false,
            "enum": ["user", "admin", "manager", "readonly"]
          }
        }
      }
    },
    {
      "name": "generateReport",
      "description": "Generate a custom report using the .NET backend",
      "displayName": "Generate Report",
      "api": {
        "url": "https://api.example.com/reports",
        "method": "POST",
        "headers": {
          "Authorization": "Bearer ${API_KEY}",
          "Content-Type": "application/json"
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "reportType": {
            "type": "string",
            "description": "Type of report to generate",
            "required": true,
            "enum": ["user_activity", "system_metrics", "audit_log", "performance"]
          },
          "startDate": {
            "type": "string",
            "description": "Start date for report data (YYYY-MM-DD)",
            "required": true,
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "description": "End date for report data (YYYY-MM-DD)",
            "required": true,
            "format": "date"
          },
          "format": {
            "type": "string",
            "description": "Output format of the report",
            "required": false,
            "default": "json",
            "enum": ["json", "csv", "pdf", "excel"]
          }
        }
      }
    }
  ]
}

Best Practices from These Examples

These examples demonstrate several key best practices:

  1. Clear, Specific Action Names: Each action has a specific, descriptive name like getCustomer or searchProducts
  2. Detailed Descriptions: All actions and parameters have clear descriptions
  3. Appropriate Parameter Requirements: Only parameters that are truly necessary are marked as required
  4. Parameter Validation: Using format constraints, enums, and min/max values
  5. Logical Grouping: Actions are grouped by their related functionality
  6. Consistent Naming: Parameter and action names follow consistent conventions
  7. Default Values: Sensible defaults are provided for optional parameters

Implementation Tips

When implementing these example tools:

  1. Replace https://api.example.com with your actual API endpoints
  2. Replace ${API_KEY} with your actual authentication method
  3. Adjust parameter requirements based on your specific API needs
  4. Ensure your API responses are formatted appropriately
  5. Test thoroughly before deploying to production

Next Steps

Built with VitePress