Skip to content

vendor_connectors.slack.tools

AI framework tools for Slack operations.

This module provides tools for Slack operations that work with multiple AI agent frameworks. The core functions are framework-agnostic Python functions, with native wrappers for each supported framework.

Supported Frameworks:

  • LangChain (via langchain-core) - get_langchain_tools()
  • CrewAI - get_crewai_tools()
  • AWS Strands - get_strands_tools() (plain functions)
  • Auto-detection - get_tools() picks the best available

Tools provided:

  • slack_list_channels: List Slack channels
  • slack_list_users: List Slack users
  • slack_send_message: Send a message to a channel
  • slack_get_channel_history: Get recent messages from a channel

Usage: from vendor_connectors.slack.tools import get_tools tools = get_tools() # Returns best format for installed framework

ListChannelsSchemaSchema for listing Slack channels.
ListUsersSchemaSchema for listing Slack users.
SendMessageSchemaSchema for sending a Slack message.
GetChannelHistorySchemaSchema for getting Slack channel history.
_get_connectorCreate a SlackConnector with tokens from environment variables.
list_channelsList Slack channels.
list_usersList Slack users.
send_messageSend a message to a Slack channel.
get_channel_historyGet recent messages from a Slack channel.
get_langchain_toolsGet all Slack tools as LangChain StructuredTools.
get_crewai_toolsGet all Slack tools as CrewAI tools.
get_strands_toolsGet all Slack tools as plain Python functions for AWS Strands.
get_toolsGet Slack tools for the specified or auto-detected framework.
TOOL_DEFINITIONS

class vendor_connectors.slack.tools.ListChannelsSchema

Section titled “class vendor_connectors.slack.tools.ListChannelsSchema”

Bases: pydantic.BaseModel

Schema for listing Slack channels.

‘Field(…)’

‘Field(…)’

‘Field(…)’

class vendor_connectors.slack.tools.ListUsersSchema

Section titled “class vendor_connectors.slack.tools.ListUsersSchema”

Bases: pydantic.BaseModel

Schema for listing Slack users.

‘Field(…)’

‘Field(…)’

‘Field(…)’

class vendor_connectors.slack.tools.SendMessageSchema

Section titled “class vendor_connectors.slack.tools.SendMessageSchema”

Bases: pydantic.BaseModel

Schema for sending a Slack message.

‘Field(…)’

‘Field(…)’

‘Field(…)’

class vendor_connectors.slack.tools.GetChannelHistorySchema

Section titled “class vendor_connectors.slack.tools.GetChannelHistorySchema”

Bases: pydantic.BaseModel

Schema for getting Slack channel history.

‘Field(…)’

‘Field(…)’

vendor_connectors.slack.tools._get_connector()

Section titled “vendor_connectors.slack.tools._get_connector()”

Create a SlackConnector with tokens from environment variables.

The slack_sdk WebClient only falls back to environment variables when token=None, not when given empty strings. We explicitly load tokens from environment to ensure proper authentication.

Returns: SlackConnector: Configured Slack connector instance.

List Slack channels.

Args: exclude_archived: Exclude archived channels when True channels_only: Return only channel-type conversations when True limit: Maximum number of channels to return

Returns: List of channels with their properties (id, name, is_private, topic, purpose, member_count)

List Slack users.

Args: include_bots: Include bot accounts when True include_deleted: Include deactivated accounts when True max_results: Maximum number of users to return

Returns: List of users with their properties (id, name, real_name, email, is_admin, is_bot)

Send a message to a Slack channel.

Args: channel: Channel name (without #) to send message to text: Message text to send thread_id: Optional thread timestamp to reply in a thread

Returns: Dict with channel, text, and timestamp of the sent message

Get recent messages from a Slack channel.

Args: channel: Channel name (without #) to get history from limit: Maximum number of messages to return

Returns: List of messages with their properties (timestamp, user, text, type)

vendor_connectors.slack.tools.TOOL_DEFINITIONS

Section titled “vendor_connectors.slack.tools.TOOL_DEFINITIONS”

None

Get all Slack tools as LangChain StructuredTools.

Returns: List of LangChain StructuredTool objects.

Raises: ImportError: If langchain-core is not installed.

Get all Slack tools as CrewAI tools.

Returns: List of CrewAI BaseTool objects.

Raises: ImportError: If crewai is not installed.

Get all Slack tools as plain Python functions for AWS Strands.

Returns: List of callable functions.

Get Slack tools for the specified or auto-detected framework.

Args: framework: Framework to use. Options:

  • “auto” (default): Auto-detect based on installed packages
  • “langchain”: Force LangChain StructuredTools
  • “crewai”: Force CrewAI tools
  • “strands”: Force plain functions for Strands
  • “functions”: Force plain functions (alias for strands)

Returns: List of tools in the appropriate format for the framework.

Raises: ImportError: If the requested framework is not installed. ValueError: If an unknown framework is specified.