Skip to main content

Tool components in Langflow

Tools are typically connected to agent components at the Tools port. Agents use LLMs as a reasoning engine to decide which of the connected tool components to use to solve a problem.

Tools in agentic functions are, essentially, functions that the agent can call to perform tasks or access external resources. A function is wrapped as a Tool object, with a common interface the agent understands. Agents become aware of tools through tool registration, where the agent is provided a list of available tools, typically at agent initialization. The Tool object's description tells the agent what the tool can do.

The agent then uses a connected LLM to reason through the problem to decide which tool is best for the job.

Use a tool in a flow

Tools are typically connected to agent components at the Tools port.

The simple agent starter project uses URL and Calculator tools connected to an agent component to answer a user's questions. The OpenAI LLM acts as a brain for the agent to decide which tool to use.

Simple agent starter flow

To make a component into a tool that an agent can use, enable Tool mode in the component. Enabling Tool mode modifies a component input to accept calls from an agent. If the component you want to connect to an agent doesn't have a Tool mode option, you can modify the component's inputs to become a tool. For an example, see Make any component a tool.

arXiv

This component searches and retrieves papers from arXiv.org.

Parameters

Inputs

NameTypeDescription
search_queryStringThe search query for arXiv papers. For example, quantum computing.
search_typeStringThe field to search in.
max_resultsIntegerThe maximum number of results to return.

Outputs

NameTypeDescription
papersList[Data]A list of retrieved arXiv papers.

Astra DB tool

This component allows agents to query data from Astra DB collections.

To use this tool in a flow, connect it to an Agent component. The flow looks like this:

Astra DB JSON tool connected to an Agent

The Tool Name and Tool Description fields are required for the Agent to decide when to use the tool. Tool Name cannot contain spaces.

The values for Collection Name, Astra DB Application Token, and Astra DB API Endpoint are found in your Astra DB deployment. For more information, see the DataStax documentation.

In this example, an OpenAI embeddings component is connected to use the Astra DB tool component's Semantic Search capability. To use Semantic Search, you must have an embedding model or Astra DB Vectorize enabled. If you try to run the flow without an embedding model, you will get an error.

Open the Playground and ask a question about your data. The Agent uses the Astra DB Tool to return information about your collection.

Define Astra DB tool parameters

The Tool Parameters configuration pane allows you to define parameters for filter conditions for the component's Find command.

These filters become available as parameters that the LLM can use when calling the tool, with a better understanding of each parameter provided by the Description field.

  1. To define a parameter for your query, in the Tool Parameters pane, click .
  2. Complete the fields based on your data. For example, with this filter, the LLM can filter by unique customer_id values.
  • Name: customer_id
  • Attribute Name: Leave empty if the attribute matches the field name in the database.
  • Description: "The unique identifier of the customer to filter by".
  • Is Metadata: False unless the value stored in the metadata field.
  • Is Mandatory: True to require this filter.
  • Is Timestamp: False since the value is an ID, not a timestamp.
  • Operator: $eq to look for an exact match.

If you want to apply filters regardless of the LLM's input, use the Static Filters option, which is available in the component's Controls pane.

ParameterDescription
NameThe name of the parameter that is exposed to the LLM. It can be the same as the underlying field name or a more descriptive label. The LLM uses this name, along with the description, to infer what value to provide during execution.
Attribute NameWhen the parameter name shown to the LLM differs from the actual field or property in the database, use this setting to map the user-facing name to the correct attribute. For example, to apply a range filter to the timestamp field, define two separate parameters, such as start_date and end_date, that both reference the same timestamp attribute.
DescriptionProvides instructions to the LLM on how the parameter should be used. Clear and specific guidance helps the LLM provide valid input. For example, if a field such as specialty is stored in lowercase, the description should indicate that the input must be lowercase.
Is MetadataWhen loading data using LangChain or Langflow, additional attributes may be stored under a metadata object. If the target attribute is stored this way, enable this option. It adjusts the query by generating a filter in the format: {"metadata.<attribute_name>": "<value>"}
Is TimestampFor date or time-based filters, enable this option to automatically convert values to the timestamp format that the Astrapy client expects. This ensures compatibility with the underlying API without requiring manual formatting.
OperatorDefines the filtering logic applied to the attribute. You can use any valid Data API filter operator. For example, to filter a time range on the timestamp attribute, use two parameters: one with the $gt operator for "greater than", and another with the $lt operator for "less than".
Parameters

Inputs

NameTypeDescription
Tool NameStringThe name used to reference the tool in the agent's prompt.
Tool DescriptionStringA brief description of the tool. This helps the model decide when to use it.
Collection NameStringThe name of the Astra DB collection to query.
TokenSecretStringThe authentication token for accessing Astra DB.
API EndpointStringThe Astra DB API endpoint.
Projection FieldsStringThe attributes to return, separated by commas. The default is *.
Tool ParametersDictParameters the model needs to fill to execute the tool. For required parameters, use an exclamation mark, for example !customer_id.
Static FiltersDictAttribute-value pairs used to filter query results.
LimitStringThe number of documents to return.

Outputs

The Data output is used when directly querying Astra DB, while the Tool output is used when integrating with agents.

NameTypeDescription
DataList[Data]A list of Data objects containing the query results from Astra DB. Each Data object contains the document fields specified by the projection attributes. Limited by the number_of_results parameter.
ToolStructuredToolA LangChain StructuredTool object that can be used in agent workflows. Contains the tool name, description, argument schema based on tool parameters, and the query function.

Astra DB CQL Tool

The Astra DB CQL Tool allows agents to query data from CQL tables in Astra DB.

Parameters

Inputs

NameTypeDescription
Tool NameStringThe name used to reference the tool in the agent's prompt.
Tool DescriptionStringA brief description of the tool to guide the model in using it.
KeyspaceStringThe name of the keyspace.
Table NameStringThe name of the Astra DB CQL table to query.
TokenSecretStringThe authentication token for Astra DB.
API EndpointStringThe Astra DB API endpoint.
Projection FieldsStringThe attributes to return, separated by commas. Default: "*".
Partition KeysDictRequired parameters that the model must fill to query the tool.
Clustering KeysDictOptional parameters the model can fill to refine the query. Required parameters should be marked with an exclamation mark, for example, !customer_id.
Static FiltersDictAttribute-value pairs used to filter query results.
LimitStringThe number of records to return.

Outputs

NameTypeDescription
DataList[Data]A list of Data objects containing the query results from the Astra DB CQL table. Each Data object contains the document fields specified by the projection fields. Limited by the number_of_results parameter.
ToolStructuredToolA LangChain StructuredTool object that can be used in agent workflows. Contains the tool name, description, argument schema based on partition and clustering keys, and the query function.

Bing Search API

This component allows you to call the Bing Search API.

Parameters

Inputs

NameTypeDescription
bing_subscription_keySecretStringA Bing API subscription key.
input_valueStringThe search query input.
bing_search_urlStringA custom Bing Search URL.
kIntegerThe number of search results to return.

Outputs

NameTypeDescription
resultsList[Data]A list of search results.
toolToolA Bing Search tool for use in LangChain.

Combinatorial Reasoner

This component runs Icosa's Combinatorial Reasoning (CR) pipeline on an input to create an optimized prompt with embedded reasons. For more information, see Icosa computing.

Parameters

Inputs

NameTypeDescription
promptStringThe input to run CR on.
openai_api_keySecretStringAn OpenAI API key for authentication.
usernameStringA username for Icosa API authentication.
passwordSecretStringA password for Icosa API authentication.
model_nameStringThe OpenAI LLM to use for reason generation.

Outputs

NameTypeDescription
optimized_promptMessageA message object containing the optimized prompt.
reasonsList[String]A list of the selected reasons that are embedded in the optimized prompt.

This component performs web searches using the DuckDuckGo search engine with result-limiting capabilities.

Parameters

Inputs

NameTypeDescription
input_valueStringThe search query to execute with DuckDuckGo.
max_resultsIntegerThe maximum number of search results to return. Default: 5.
max_snippet_lengthIntegerThe maximum length of each result snippet. Default: 100.

Outputs

NameTypeDescription
dataList[Data]A list of search results as Data objects containing snippets and full content.
textStringThe search results formatted as a single text string.

This component provides an Exa Search toolkit for search and content retrieval.

Parameters

Inputs

NameTypeDescription
metaphor_api_keySecretStringAn API key for Exa Search.
use_autopromptBooleanWhether to use the autoprompt feature. Default: true.
search_num_resultsIntegerThe number of results to return for search. Default: 5.
similar_num_resultsIntegerThe number of similar results to return. Default: 5.

Outputs

NameTypeDescription
toolsList[Tool]A list of search tools provided by the toolkit.

Glean Search API

This component allows you to call the Glean Search API.

Parameters

Inputs

NameTypeDescription
glean_api_urlStringThe URL of the Glean API.
glean_access_tokenSecretStringAn access token for Glean API authentication.
queryStringThe search query input.
page_sizeIntegerThe number of results per page. Default: 10.
request_optionsDictAdditional options for the API request.

Outputs

NameTypeDescription
resultsList[Data]A list of search results.
toolToolA Glean Search tool for use in LangChain.

Google Serper API

This component allows you to call the Serper.dev Google Search API.

Parameters

Inputs

NameTypeDescription
serper_api_keySecretStringAn API key for Serper.dev authentication.
input_valueStringThe search query input.
kIntegerThe number of search results to return.

Outputs

NameTypeDescription
resultsList[Data]A list of search results.
toolToolA Google Serper search tool for use in LangChain.

MCP server

This component connects to a Model Context Protocol (MCP) server and exposes the MCP server's tools as tools for Langflow agents.

In addition to being an MCP client that can leverage MCP servers, the MCP component's SSE mode allows you to connect your flow to the Langflow MCP server at the /api/v1/mcp/sse API endpoint, exposing all flows within your project as tools within a flow.

To use the MCP server component with an agent component, follow these steps:

  1. Add the MCP server component to your workflow.

  2. In the MCP server component, in the MCP Command field, enter the command to start your MCP server. For example, to start a Fetch server, the command is:


    _10
    uvx mcp-server-fetch

    uvx is included with uv in the Langflow package. To use npx server commands, you must first install an LTS release of Node.js. For an example of starting npx MCP servers, see Connect an Astra DB MCP server to Langflow.

    To include environment variables with your server command, add them to the Env field like this:


    _10
    ASTRA_DB_APPLICATION_TOKEN=AstraCS:...

    important

    Langflow passes environment variables from the .env file to MCP, but not global variables declared in the UI. To add a value for an environment variable as a global variable, add it to Langflow's .env file at startup. For more information, see global variables.

  3. Click to get the server's list of Tools.

  4. In the Tool field, select the server tool you want the component to use. The available fields change based on the selected tool. For information on the parameters, see the MCP server's documentation.

  5. In the MCP server component, enable Tool mode. Connect the MCP server component's Toolset port to an Agent component's Tools port.

    The flow looks similar to this: MCP server component

  6. Open the Playground. Ask the agent to summarize recent tech news. The agent calls the MCP server function fetch and returns the summary. This confirms the MCP server is connected, and its tools are being used in Langflow.

For more information, see MCP server.

MCP Server-Sent Events (SSE) mode

important

If you're using Langflow for Desktop, the default address is http://127.0.0.1:7868/.

The MCP component's SSE mode connects your flow to the Langflow MCP server through the component. This allows you to use all flows within your project as tools within a flow.

  1. In the MCP Server component, select SSE. A default address appears in the MCP SSE URL field.
  2. In the MCP SSE URL field, modify the default address to point at the SSE endpoint of the Langflow server you're currently running. The default value is http://localhost:7860/api/v1/mcp/sse.
  3. In the MCP Server component, click to retrieve the server's list of Tools.
  4. Click the Tools field. All of your flows are listed as tools.
  5. Enable Tool Mode, and then connect the MCP Server component to an agent component's tool port. The flow looks like this: MCP server component
  6. Open the Playground and chat with your tool. The agent chooses the correct tool based on your query.
Parameters

Inputs

NameTypeDescription
commandStringThe MCP command. Default: uvx mcp-sse-shim@latest.

Outputs

NameTypeDescription
toolsList[Tool]A list of tools exposed by the MCP server.

Wikidata

This component performs a search using the Wikidata API.

Parameters

Inputs

NameTypeDescription
queryStringThe text query for similarity search on Wikidata.

Outputs

NameTypeDescription
dataList[Data]The search results from Wikidata API as a list of Data objects.
textMessageThe search results formatted as a text message.

Legacy components

Legacy components are available for use but are no longer supported.

Calculator Tool

This component allows you to evaluate basic arithmetic expressions. It supports addition, subtraction, multiplication, division, and exponentiation.

Parameters

Inputs

NameTypeDescription
expressionStringThe arithmetic expression to evaluate. For example, 4*4*(33/22)+12-20.

Outputs

NameTypeDescription
resultToolA calculator tool for use in LangChain.

Google Search API

This component allows you to call the Google Search API.

Parameters

Inputs

NameTypeDescription
google_api_keySecretStringA Google API key for authentication.
google_cse_idSecretStringA Google Custom Search Engine ID.
input_valueStringThe search query input.
kIntegerThe number of search results to return.

Outputs

NameTypeDescription
resultsList[Data]A list of search results.
toolToolA Google Search tool for use in LangChain.

Python Code Structured Tool

This component creates a structured tool from Python code using a dataclass.

The component dynamically updates its configuration based on the provided Python code, allowing for custom function arguments and descriptions.

Parameters

Inputs

NameTypeDescription
tool_codeStringThe Python code for the tool's dataclass.
tool_nameStringThe name of the tool.
tool_descriptionStringThe description of the tool.
return_directBooleanWhether to return the function output directly.
tool_functionStringThe selected function for the tool.
global_variablesDictGlobal variables or data for the tool.

Outputs

NameTypeDescription
result_toolToolA structured tool created from the Python code.

Python REPL Tool

This component creates a Python REPL (Read-Eval-Print Loop) tool for executing Python code.

Parameters

Inputs

NameTypeDescription
nameStringThe name of the tool. Default: python_repl.
descriptionStringA description of the tool's functionality.
global_importsList[String]A list of modules to import globally. Default: math.

Outputs

NameTypeDescription
toolToolA Python REPL tool for use in LangChain.

Retriever Tool

This component creates a tool for interacting with a retriever in LangChain.

Parameters

Inputs

NameTypeDescription
retrieverBaseRetrieverThe retriever to interact with.
nameStringThe name of the tool.
descriptionStringA description of the tool's functionality.

Outputs

NameTypeDescription
toolToolA retriever tool for use in LangChain.

Search API

This component calls the searchapi.io API. It can be used to search the web for information.

For more information, see the SearchAPI documentation.

Parameters

Inputs

NameTypeDescription
engineStringThe search engine to use. Default: google.
api_keySecretStringThe API key for authenticating with SearchAPI.
input_valueStringThe search query or input for the API call.
search_paramsDictAdditional parameters for customizing the search.

Outputs

NameTypeDescription
dataList[Data]A list of Data objects containing search results.
toolToolA Tool object for use in LangChain workflows.

SearXNG Search Tool

This component creates a tool for searching using SearXNG, a metasearch engine.

Parameters

Inputs

NameTypeDescription
urlStringThe URL of the SearXNG instance.
max_resultsIntegerThe maximum number of results to return.
categoriesList[String]The categories to search in.
languageStringThe language for the search results.

Outputs

NameTypeDescription
result_toolToolA SearXNG search tool for use in LangChain.

Wikipedia API

This component creates a tool for searching and retrieving information from Wikipedia.

Parameters

Inputs

NameTypeDescription
input_valueStringThe search query input.
langStringThe language code for Wikipedia. Default: en.
kIntegerThe number of results to return.
load_all_available_metaBooleanWhether to load all available metadata.
doc_content_chars_maxIntegerThe maximum number of characters for document content.

Outputs

NameTypeDescription
resultsList[Data]A list of Wikipedia search results.
toolToolA Wikipedia search tool for use in LangChain.

Deprecated components

Deprecated components have been replaced by newer alternatives and should not be used in new projects.

MCP Tools (stdio)

important

This component is deprecated as of Langflow version 1.3. Instead, use the MCP server component

MCP Tools (SSE)

important

This component is deprecated as of Langflow version 1.3. Instead, use the MCP server component

Search