Custom Tools and Plugins for LLMs
Develop and integrate custom tools that LLMs can leverage to extend their capabilities beyond their core knowledge.
Custom Tools and Plugins for LLMs is a free AI Prompt Engineering lesson on CoddyKit — lesson 3 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Prompt Engineering learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What are Custom Tools?
Welcome to the final lesson in our 'Advanced Prompting with Tool Use and Agents' course! Today, we'll dive into custom tools and plugins for Large Language Models (LLMs).
Custom tools allow LLMs to go beyond their training data and interact with the real world or specific systems. Think of them as special skills you teach an LLM.
- Extend Capabilities: Add new functions.
- Access Real-time Data: Get current info.
- Perform Actions: Make changes in external systems.
Custom vs. Built-in Capabilities
You've learned about basic function calling and API integration. Custom tools take this a step further.
While an LLM might know how to 'summarize text' inherently, it doesn't know how to 'check the weather in London' unless you provide a tool for it. Custom tools bridge this gap, giving the LLM specific, external capabilities that aren't part of its core knowledge base.
Anatomy of a Custom Tool
Every custom tool needs a clear definition so the LLM knows when and how to use it. Key components include:
- Name: A unique identifier (e.g.,
get_current_time). - Description: Explains what the tool does and when to use it. This is crucial for the LLM's decision-making.
- Parameters: Inputs the tool needs to function (e.g.,
timezonefor a time tool). - Expected Output: What kind of information the tool returns.
Describing Tools with Schema
To 'teach' an LLM about a custom tool, we provide its definition in a structured format, often a JSON schema. This schema tells the LLM everything it needs to know to call the tool correctly.
Here's a simplified example of how our get_current_time tool might be described:
{
"name": "get_current_time",
"description": "Gets the current time in a specified timezone.",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "The timezone to get the time for (e.g., UTC, America/New_York)."
}
},
"required": []
}
}Building a Simple Tool: Get Time
Let's create a practical example: a tool named get_current_time. This tool will simply return the current time, optionally for a given timezone.
While the LLM understands the description (from the schema), we are responsible for writing the actual code that performs the action described. This code runs externally when the LLM decides to invoke the tool.
Tool Implementation Example
This Python code snippet shows what the get_current_time tool might look like behind the scenes. When the LLM calls the tool, it executes this function (or similar logic in your chosen language) and gets the result.
Try running it to see its output!
import datetime
def get_current_time(timezone="UTC"):
"""
Returns the current time in the specified timezone.
"""
# For simplicity, we'll return UTC time and note timezone
now = datetime.datetime.now(datetime.timezone.utc)
return f"Current time in {timezone}: {now.strftime('%Y-%m-%d %H:%M:%S')} (UTC basis)"
# This is the entry point that would be called by the LLM's integration layer
if __name__ == "__main__":
print(get_current_time())
print(get_current_time(timezone="America/New_York"))LLM's Tool Invocation Flow
Here's how an LLM typically uses a custom tool:
- User Prompt: You ask the LLM a question (e.g., "What time is it in New York?").
- LLM Decision: The LLM analyzes your prompt and its available tool descriptions.
- Tool Call: If a tool is relevant, the LLM generates a tool call (e.g.,
get_current_time(timezone="America/New_York")). - Execution: Your system executes the actual tool code.
- Result: The tool's output is returned to the LLM.
- LLM Response: The LLM uses the tool's output to formulate its final answer to you.
Prompting with Custom Tools
When you prompt an LLM that has access to custom tools, you don't explicitly tell it to use the tool. You simply ask a question that implies the need for the tool.
The LLM's ability to understand the tool's description is key. A good description helps the LLM choose the right tool at the right time.
- Prompt:
"What is the current time right now?" - LLM Action: Invokes
get_current_time() - Tool Output:
"Current time in UTC: 2023-10-27 10:30:00 (UTC basis)" - LLM Response:
"The current time is 10:30 AM UTC."
Benefits of Custom Tools
Custom tools unlock powerful capabilities for LLMs:
- Domain Specificity: Provide LLMs with knowledge beyond their general training.
- Real-time Interaction: Access up-to-the-minute information (e.g., stock prices, weather).
- Actionable AI: Enable LLMs to perform actions (e.g., send emails, book appointments).
- Enhanced Accuracy: Reduce hallucinations by relying on factual tool outputs.
- Modularity: Keep LLM logic separate from external system interactions.
Quick Check: Custom Tools
Which of the following are essential components of a custom tool's definition for an LLM?
Recap: Extend LLM Power
In this lesson, we explored custom tools and plugins, a powerful way to extend LLMs' capabilities.
- Custom tools allow LLMs to interact with external systems and data.
- They require a clear definition (name, description, parameters) often using JSON schema.
- You implement the actual logic that runs when the LLM calls the tool.
- Custom tools enable LLMs to gain domain-specific knowledge, access real-time data, and perform actions, moving beyond simple text generation.
By mastering custom tools, you can build truly intelligent and interactive AI applications!
Frequently asked questions
Is the “Custom Tools and Plugins for LLMs” lesson free?
Yes — the full text of “Custom Tools and Plugins for LLMs” is free to read here on the web, and the AI Prompt Engineering course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Prompt Engineering course, upgrade to CoddyKit PRO.
What will I learn in “Custom Tools and Plugins for LLMs”?
Develop and integrate custom tools that LLMs can leverage to extend their capabilities beyond their core knowledge. You practise AI Prompt Engineering with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AI Prompt Engineering?
No prior experience is required. AI Prompt Engineering on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 3, so you can start here or from the beginning and move at your own pace.
How long does the “Custom Tools and Plugins for LLMs” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AI Prompt Engineering lesson?
Yes. Every AI Prompt Engineering lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Function Calling and API Integration
- Multi-Agent Prompting Systems
- Custom Tools and Plugins for LLMs