LLM Tool Call Example List
Below is a comprehensive list of 25 distinct types of LLM tool calls. Each entry includes:
- The tool name.
- A complete, OpenAI-compatible JSON schema (ready for inclusion in the
toolsarray of a/v1/chat/completionsrequest). - A precise explanation of the tool’s purpose and typical backend implementation.
These examples demonstrate a broad range of capabilities, from information retrieval and computation to productivity, external integrations, and data analysis. They illustrate the division of labor in tool-calling architectures: the LLM intelligently selects the tool and populates parameters, while backend Python (or equivalent) executes the function and returns results for final synthesis.
1. get_current_weather
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Retrieve the current weather conditions for a specified location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name, zip code, or latitude/longitude coordinates (e.g., 'New York' or '40.7128,-74.0060')"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "Preferred temperature unit",
"default": "celsius"
}
},
"required": ["location"]
}
}
}
This tool queries a weather service API (e.g., OpenWeatherMap) with the provided location and unit. The backend parses the response and returns structured text containing temperature, conditions, humidity, and wind information.
2. web_search
{
"type": "function",
"function": {
"name": "web_search",
"description": "Perform a general web search and return relevant results with snippets.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query or keywords"
},
"num_results": {
"type": "integer",
"description": "Maximum number of results to return",
"default": 5
}
},
"required": ["query"]
}
}
}
The backend forwards the query to a search engine API or index, extracts titles, URLs, and brief snippets, and returns them as formatted text for the LLM to summarize or cite.
3. calculate
{
"type": "function",
"function": {
"name": "calculate",
"description": "Safely evaluate a mathematical expression and return the result.",
"parameters": {
"type": "object",
"properties": {
"expression": {
"type": "string",
"description": "Mathematical expression to evaluate (e.g., '15 + 32 * 2')"
}
},
"required": ["expression"]
}
}
}
The backend uses a secure evaluator (e.g., Python’s ast.literal_eval or a restricted interpreter) to compute the result and returns a plain-text string such as “Result: 79”.
4. get_stock_price
{
"type": "function",
"function": {
"name": "get_stock_price",
"description": "Retrieve the current or historical stock price for a ticker symbol.",
"parameters": {
"type": "object",
"properties": {
"ticker": {
"type": "string",
"description": "Stock ticker symbol (e.g., 'AAPL')"
},
"date": {
"type": "string",
"description": "Optional date in YYYY-MM-DD format for historical price"
}
},
"required": ["ticker"]
}
}
}
The backend calls a financial data API, parses price, volume, and change data, and returns a concise textual summary.
5. wikipedia_search
{
"type": "function",
"function": {
"name": "wikipedia_search",
"description": "Search Wikipedia and return article summaries.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search term or topic"
},
"max_results": {
"type": "integer",
"description": "Maximum number of summaries to return",
"default": 3
}
},
"required": ["query"]
}
}
}
The backend queries the Wikipedia API, extracts the top matching articles, and returns their titles and concise summaries.
6. get_current_datetime
{
"type": "function",
"function": {
"name": "get_current_datetime",
"description": "Return the current date and time in the requested timezone.",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "IANA timezone name (e.g., 'America/New_York')",
"default": "UTC"
}
}
}
}
}
The backend uses the system clock and timezone library to format and return the current datetime as a readable string.
7. code_execution
{
"type": "function",
"function": {
"name": "code_execution",
"description": "Execute Python code in a secure sandbox and return the output.",
"parameters": {
"type": "object",
"properties": {
"python_code": {
"type": "string",
"description": "Python code snippet to execute"
}
},
"required": ["python_code"]
}
}
}
The backend runs the code in an isolated environment with restricted libraries and returns stdout, results, or any printed output.
8. send_email
{
"type": "function",
"function": {
"name": "send_email",
"description": "Send an email via the configured SMTP service.",
"parameters": {
"type": "object",
"properties": {
"to": {
"type": "string",
"description": "Recipient email address"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content (plain text or HTML)"
},
"cc": {
"type": "array",
"items": { "type": "string" },
"description": "Optional CC recipients"
}
},
"required": ["to", "subject", "body"]
}
}
}
The backend authenticates with an SMTP server, constructs the message, and dispatches it, returning a confirmation status.
9. read_file
{
"type": "function",
"function": {
"name": "read_file",
"description": "Read the content of a local file and return its text.",
"parameters": {
"type": "object",
"properties": {
"file_path": {
"type": "string",
"description": "Absolute or relative path to the file"
}
},
"required": ["file_path"]
}
}
}
The backend opens the file, reads its contents (with appropriate encoding), and returns the text for further processing by the LLM.
10. browse_page
{
"type": "function",
"function": {
"name": "browse_page",
"description": "Fetch and optionally summarize the content of a webpage.",
"parameters": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "Full URL of the webpage"
},
"instructions": {
"type": "string",
"description": "Optional instructions for summarization or extraction"
}
},
"required": ["url"]
}
}
}
The backend performs an HTTP request, parses the HTML, and either returns raw text or applies summarization logic according to the instructions.
11. generate_image
{
"type": "function",
"function": {
"name": "generate_image",
"description": "Generate an image from a text prompt using a text-to-image model.",
"parameters": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "Detailed description of the desired image"
},
"size": {
"type": "string",
"enum": ["1024x1024", "512x512"],
"default": "1024x1024"
}
},
"required": ["prompt"]
}
}
}
The backend calls a compatible image-generation API and returns a URL or base64-encoded image reference.
12. translate_text
{
"type": "function",
"function": {
"name": "translate_text",
"description": "Translate text from one language to another.",
"parameters": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text to translate"
},
"target_language": {
"type": "string",
"description": "Target language code (e.g., 'es', 'fr')"
},
"source_language": {
"type": "string",
"description": "Optional source language code"
}
},
"required": ["text", "target_language"]
}
}
}
The backend invokes a translation service or model and returns the translated string.
13. get_directions
{
"type": "function",
"function": {
"name": "get_directions",
"description": "Provide step-by-step directions between two locations.",
"parameters": {
"type": "object",
"properties": {
"origin": {
"type": "string",
"description": "Starting location"
},
"destination": {
"type": "string",
"description": "Destination location"
},
"mode": {
"type": "string",
"enum": ["driving", "walking", "transit", "bicycling"],
"default": "driving"
}
},
"required": ["origin", "destination"]
}
}
}
The backend queries a mapping API and returns a numbered list of directions with estimated time and distance.
14. get_news
{
"type": "function",
"function": {
"name": "get_news",
"description": "Retrieve recent news articles on a specified topic.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Topic or keyword"
},
"count": {
"type": "integer",
"description": "Number of articles to return",
"default": 5
}
},
"required": ["query"]
}
}
}
The backend fetches articles from a news API and returns titles, sources, dates, and brief summaries.
15. create_calendar_event
{
"type": "function",
"function": {
"name": "create_calendar_event",
"description": "Create a new event in the user’s calendar.",
"parameters": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Event title"
},
"start_time": {
"type": "string",
"description": "Start time in ISO format"
},
"end_time": {
"type": "string",
"description": "End time in ISO format"
},
"description": {
"type": "string",
"description": "Optional event description"
}
},
"required": ["title", "start_time", "end_time"]
}
}
}
The backend authenticates with a calendar service (e.g., Google Calendar) and inserts the event, returning a confirmation with the event ID.
16. sql_query
{
"type": "function",
"function": {
"name": "sql_query",
"description": "Execute a read-only SQL query against a database.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "SQL SELECT statement"
}
},
"required": ["query"]
}
}
}
The backend runs the query on a configured database and returns the result rows as a formatted table or JSON string.
17. analyze_image
{
"type": "function",
"function": {
"name": "analyze_image",
"description": "Analyze an image and answer questions about its content.",
"parameters": {
"type": "object",
"properties": {
"image_url": {
"type": "string",
"description": "Public URL of the image"
},
"question": {
"type": "string",
"description": "Specific question about the image"
}
},
"required": ["image_url", "question"]
}
}
}
The backend forwards the image and question to a vision model and returns a textual description or answer.
18. convert_currency
{
"type": "function",
"function": {
"name": "convert_currency",
"description": "Convert an amount from one currency to another.",
"parameters": {
"type": "object",
"properties": {
"amount": {
"type": "number",
"description": "Amount to convert"
},
"from_currency": {
"type": "string",
"description": "Source currency code (e.g., 'USD')"
},
"to_currency": {
"type": "string",
"description": "Target currency code (e.g., 'EUR')"
}
},
"required": ["amount", "from_currency", "to_currency"]
}
}
}
The backend obtains the latest exchange rate from a financial API, performs the conversion, and returns the result.
19. get_flight_status
{
"type": "function",
"function": {
"name": "get_flight_status",
"description": "Retrieve real-time status for a commercial flight.",
"parameters": {
"type": "object",
"properties": {
"flight_number": {
"type": "string",
"description": "Flight number (e.g., 'AA123')"
},
"date": {
"type": "string",
"description": "Flight date in YYYY-MM-DD format"
}
},
"required": ["flight_number"]
}
}
}
The backend queries an aviation data API and returns departure/arrival times, gate, and status.
20. vector_search
{
"type": "function",
"function": {
"name": "vector_search",
"description": "Perform semantic search in a vector database for retrieval-augmented generation.",
"parameters": {
"type": "object",
"properties": {
"query_text": {
"type": "string",
"description": "Natural language search query"
},
"top_k": {
"type": "integer",
"description": "Number of top results to return",
"default": 5
}
},
"required": ["query_text"]
}
}
}
The backend embeds the query, performs a similarity search, and returns the most relevant document chunks.
21. extract_pdf_text
{
"type": "function",
"function": {
"name": "extract_pdf_text",
"description": "Extract plain text from a PDF document.",
"parameters": {
"type": "object",
"properties": {
"pdf_url": {
"type": "string",
"description": "Public URL or local path to the PDF"
}
},
"required": ["pdf_url"]
}
}
}
The backend downloads or opens the PDF, extracts text via a library such as PyPDF2, and returns the content.
22. text_to_speech
{
"type": "function",
"function": {
"name": "text_to_speech",
"description": "Convert text to spoken audio and return a playable link.",
"parameters": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text to convert to speech"
},
"voice": {
"type": "string",
"description": "Optional voice identifier",
"default": "default"
}
},
"required": ["text"]
}
}
}
The backend calls a text-to-speech service and returns a URL to the generated audio file.
23. get_customer_info
{
"type": "function",
"function": {
"name": "get_customer_info",
"description": "Retrieve customer record from a CRM system.",
"parameters": {
"type": "object",
"properties": {
"customer_id": {
"type": "string",
"description": "Unique customer identifier or email"
}
},
"required": ["customer_id"]
}
}
}
The backend queries the CRM database and returns key fields such as name, contact details, and recent activity.
24. post_to_social_media
{
"type": "function",
"function": {
"name": "post_to_social_media",
"description": "Publish content to a specified social media platform.",
"parameters": {
"type": "object",
"properties": {
"platform": {
"type": "string",
"enum": ["twitter", "linkedin", "facebook"],
"description": "Target social platform"
},
"message": {
"type": "string",
"description": "Post content"
},
"image_url": {
"type": "string",
"description": "Optional image URL to attach"
}
},
"required": ["platform", "message"]
}
}
}
The backend authenticates with the platform’s API and posts the message, returning the published post ID.
25. book_hotel
{
"type": "function",
"function": {
"name": "book_hotel",
"description": "Search and book available hotel rooms based on criteria.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City or hotel area"
},
"check_in_date": {
"type": "string",
"description": "Check-in date in YYYY-MM-DD format"
},
"check_out_date": {
"type": "string",
"description": "Check-out date in YYYY-MM-DD format"
},
"guests": {
"type": "integer",
"description": "Number of guests"
}
},
"required": ["location", "check_in_date", "check_out_date", "guests"]
}
}
}
The backend queries a hotel reservation API, selects the best match, completes the booking transaction, and returns a confirmation number.