Find and Discover Tools LangChain
The find_tools
function in the Knit LangChain SDK allows you to discover tools that are available for integration with a specific app or the unified tools for a category.
The function will return a list of tools. You can then select and use these tools in your AI agents.
Discover Tools for an App
Parameters Overview
-
app_id
: Specify the app ID to find tools related to a specific app. You can find the list of apps here: https://developers.getknit.dev/reference/supported-apps -
entities
: (Optional) Provide a list of entities if you're looking for tools handling specific data or functionalities. -
operation
: (Optional) Define the type of operation (like "read" or "write") that the tool should support. -
include_unified_tools
: Set this toTrue
if you want to include Knit's Unified Tools for this app's category -
usecase
: Search tools by your use case in plain English
Example Usage
Here's a quick example to demonstrate how you can use the find_tools
function:
from knit_langchain import KnitLangChain
# Initialize the Knit SDK with your API key
knit = KnitLangChain(api_key="YOUR_KNIT_API_KEY")
# Find tools related to a specific app and operation
tools = knit.find_tools(app_id="charliehr", operation="read", usecase="I want to fetch the list of employees")
# Display tool information
for tool in tools:
print(f"Tool ID: {tool.tool_id}")
print(f"Title: {tool.title}")
print(f"Description: {tool.description}")
Discover Unified Tools for a Category
Parameters Overview
-
category_id
: Use this to search Knit's Unified APIs tools by category. You can find the list of categories here: https://developers.getknit.dev/reference/supported-apps -
entities
: (Optional) Provide a list of entities if you're looking for tools handling specific data or functionalities. -
operation
: (Optional) Define the type of operation (like "read" or "write") that the tool should support. -
include_unified_tools
: Must be set toTrue
-
usecase
: Search tools by your use case in plain English
Example Usage
Here's a quick example to demonstrate how you can use the find_tools
function:
from knit_langchain import KnitLangChain
# Initialize the Knit SDK with your API key
knit = KnitLangChain(api_key="YOUR_KNIT_API_KEY")
# Find tools related to a specific app and operation
tools = knit.find_tools(category_id="ticketing", include_unified_tools=True, usecase="I want to add a comment to ticket")
# Display tool information
for tool in tools:
print(f"Tool ID: {tool.tool_id}")
print(f"Title: {tool.title}")
print(f"Description: {tool.description}")
What It Returns
- The function returns a list of tool summaries, which are objects containing key information about each tool. Each tool summary includes:
tool_id
: The unique identifier for the tool.title
: The name of the tool.description
: A brief description of the tool's functionality.entities
: The entities associated with the tool (if any).operation
: The operation the tool supports (if specified).is_unified_tool
: Indicates whether the tool is a Knit's Unified APIs tool.
Updated 4 days ago