> ## Documentation Index > Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt > Use this file to discover all available pages before exploring further. # ChatFunctionTool Tool definition for function calling (regular function or OpenRouter built-in server tool) ## Supported Types ### ChatFunctionToolFunction ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolChatFunctionToolFunction(components.ChatFunctionToolFunction{/* values here */}) ``` ### AdvisorServerToolOpenRouter ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolAdvisorServerToolOpenRouter(components.AdvisorServerToolOpenRouter{/* values here */}) ``` ### BashServerTool ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolBashServerTool(components.BashServerTool{/* values here */}) ``` ### DatetimeServerTool ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolDatetimeServerTool(components.DatetimeServerTool{/* values here */}) ``` ### FilesServerTool ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolFilesServerTool(components.FilesServerTool{/* values here */}) ``` ### FusionServerToolOpenRouter ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolFusionServerToolOpenRouter(components.FusionServerToolOpenRouter{/* values here */}) ``` ### ImageGenerationServerToolOpenRouter ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolImageGenerationServerToolOpenRouter(components.ImageGenerationServerToolOpenRouter{/* values here */}) ``` ### ChatSearchModelsServerTool ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolChatSearchModelsServerTool(components.ChatSearchModelsServerTool{/* values here */}) ``` ### SubagentServerToolOpenRouter ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolSubagentServerToolOpenRouter(components.SubagentServerToolOpenRouter{/* values here */}) ``` ### WebFetchServerTool ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolWebFetchServerTool(components.WebFetchServerTool{/* values here */}) ``` ### OpenRouterWebSearchServerTool ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolOpenRouterWebSearchServerTool(components.OpenRouterWebSearchServerTool{/* values here */}) ``` ### ChatWebSearchShorthand ```go theme={null} chatFunctionTool := components.CreateChatFunctionToolChatWebSearchShorthand(components.ChatWebSearchShorthand{/* values here */}) ``` ## Union Discrimination Use the `Type` field to determine which variant is active, then access the corresponding field: ```go theme={null} switch chatFunctionTool.Type { case components.ChatFunctionToolUnionTypeChatFunctionToolFunction: // chatFunctionTool.ChatFunctionToolFunction is populated case components.ChatFunctionToolUnionTypeAdvisorServerToolOpenRouter: // chatFunctionTool.AdvisorServerToolOpenRouter is populated case components.ChatFunctionToolUnionTypeBashServerTool: // chatFunctionTool.BashServerTool is populated case components.ChatFunctionToolUnionTypeDatetimeServerTool: // chatFunctionTool.DatetimeServerTool is populated case components.ChatFunctionToolUnionTypeFilesServerTool: // chatFunctionTool.FilesServerTool is populated case components.ChatFunctionToolUnionTypeFusionServerToolOpenRouter: // chatFunctionTool.FusionServerToolOpenRouter is populated case components.ChatFunctionToolUnionTypeImageGenerationServerToolOpenRouter: // chatFunctionTool.ImageGenerationServerToolOpenRouter is populated case components.ChatFunctionToolUnionTypeChatSearchModelsServerTool: // chatFunctionTool.ChatSearchModelsServerTool is populated case components.ChatFunctionToolUnionTypeSubagentServerToolOpenRouter: // chatFunctionTool.SubagentServerToolOpenRouter is populated case components.ChatFunctionToolUnionTypeWebFetchServerTool: // chatFunctionTool.WebFetchServerTool is populated case components.ChatFunctionToolUnionTypeOpenRouterWebSearchServerTool: // chatFunctionTool.OpenRouterWebSearchServerTool is populated case components.ChatFunctionToolUnionTypeChatWebSearchShorthand: // chatFunctionTool.ChatWebSearchShorthand is populated } ```