Tools and models from your code
Your code can use any NappAI tool or model: an MCP server, your CRM, a web search, a language model… It is useful when you want to do the same thing with many items and get the same result every time, without depending on an agent’s decisions.
1. Turn on the inputs
In the component’s Advanced tab:
- Enable Tools Input adds the Tools connector.
- Enable Models Input adds the Model connector.
You can connect several components to each one: tools through their Tool output and models through their model output.
2. Call them by name
# A tool: by its name, with its datastatus = tools["check_domain"](arg_name="beanorigin", arg_tld="com")
# A model: by the title of its component on the canvas, with your questionanswer = models["DeepSeek"]("Sum up in one sentence: " + text)print(answer["content"])- Tools are called by their tool name, and their data is passed by name. What the tool returns arrives as is.
- Models are called by the title of their component on the canvas. The answer’s text is in
["content"]. - Don’t know their names? Run the component with
return toolsorreturn models: you will see each available tool or model, its data, and an example call ready to copy. - If a tool or a model fails, your code gets the error and the run stops, unless you handle it with
tryandexcept.
Each run allows up to 500 tool calls and 500 model calls.
Example
A coffee shop wants to choose a brand. It keeps a list of eight names in a volume and builds a flow with Python Code, the Find-A-Domain MCP server and DeepSeek connected. The code goes through the list, checks each name’s .com domain with the tool, saves the results table in the volume, and asks the model for a recommendation among the free names. It is the flow in the Python Code video.
For an agent to decide on its own when to use a tool, connect it to the agent instead of to your code. See Use MCP servers.