> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # defineTools > Protected lifecycle hook for registering SWAIG tools in subclass constructors. [define-tool]: /docs/server-sdks/reference/typescript/agents/agent-base/define-tool [register-swaig-function]: /docs/server-sdks/reference/typescript/agents/agent-base/register-swaig-function Protected lifecycle method for registering tools on the agent. Subclasses override this method to call [`defineTool()`][define-tool] or [`registerSwaigFunction()`][register-swaig-function] after all instance fields are initialized. > **Note** > > This method is **not** called automatically. Subclasses must invoke > `this.defineTools()` explicitly at the end of their constructor. ## **Parameters** None. ## **Returns** `void` ## **Example** ```typescript {7} import { AgentBase } from '@signalwire/sdk'; class WeatherAgent extends AgentBase { constructor() { super({ name: 'weather', route: '/weather' }); this.setPromptText('You are a weather assistant.'); this.defineTools(); } protected override defineTools(): void { this.defineTool({ name: 'check_weather', description: 'Check the current weather', parameters: { type: 'object', properties: { city: { type: 'string', description: 'City name' }, }, required: ['city'], }, handler: async (args) => { return { response: `The weather in ${args.city} is sunny and 72F.` }; }, }); } } const agent = new WeatherAgent(); await agent.serve(); ``` > Protected lifecycle hook for registering SWAIG tools in subclass constructors.