Function: isContextAwareTool()
@providerprotocol/agents / index / isContextAwareTool
Function: isContextAwareTool()
Section titled “Function: isContextAwareTool()”isContextAwareTool(
tool):boolean
Defined in: src/execution/tool-context.ts:146
Checks if a tool is context-aware (accepts execution context as second parameter).
Context-aware tools have a run function with arity > 1, meaning they
accept the optional ToolExecutionContext parameter. This allows them
to access agent information and emit sub-agent events.
Parameters
Section titled “Parameters”Tool
The tool to check
Returns
Section titled “Returns”boolean
true if the tool’s run function accepts more than one parameter
Example
Section titled “Example”import { isContextAwareTool } from '@providerprotocol/agents/execution';
const standardTool = { name: 'simple', run: async (params) => 'result', // arity = 1};
const contextTool = { name: 'advanced', run: async (params, context) => 'result', // arity = 2};
isContextAwareTool(standardTool); // falseisContextAwareTool(contextTool); // true