KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using registerTool() to Enforce Data Boundaries
PRODUCT: 4D | VERSION: 21 | PLATFORM: Mac & Win
Published On: March 26, 2026
Tool calling should be used as a strict boundary between the AI model and application data. Instead of exposing generic or broad access, each tool should target a specific defined use case (e.g., public profile lookup vs. salary access).

Registering multiple small, purpose-specific tools rather than a single large one reduces ambiguity in tool selection and limits the risk of unintended data exposure.

The model is more reliable when each tool has a clear and focused responsibility.

Example:
var $chatHelper:=$client.chat.create("You are an HR assistant.")

$chatHelper.registerTool(cs.Tool_GetPublicInfo.new())
$chatHelper.registerTool(cs.Tool_GetPrivateInfo.new())


Separating tools by data sensitivity or business domain improves tool-calling accuracy.