Skip to content

abt-slack-tools

abt-slack-tools is a first-party abt package with SDK-backed @tool functions — slack_search, slack_thread_view, slack_channel_history and slack_post_message — backed by slack_sdk (install abt-core[slack]; abt deps does not), not Slack MCP.

Slack MCP (external) abt-slack-tools (SDK)
Schema injection per call Large tool schemas 0 extra MCP tokens
Prerequisites MCP server + tokens abt-core[slack] installed (uv pip install "abt-core[slack]"). abt deps does not install it.
Post replies Varies slack_post_message (write; gated by config)
Host binary — None (slack_sdk only)

Package id: abt-slack-tools · Shorthand: slack

Write tools default off (defaults.allow_writes: false). The built-in slack exposure remains for agent dispatch.

Tool catalog

Component Manifest tool Registry name Access
search slack_search slack_search read
threads slack_thread_view slack_thread_view read
history slack_channel_history slack_channel_history read
messaging slack_post_message slack_post_message write
abt docs package slack --project-root .

Tool spec syntax

tools:
  - slack__slack_search
  - slack__slack_thread_view
  - slack__slack_channel_history
  - slack__slack_post_message    # write — requires allow_writes

Backend: slack_sdk

The tools call abt.integrations.slack, shared with the slack_search retriever and the slack_thread source (thread rendering).

Credentials: profiles.yaml → credentials.slack with bot_token, and optionally user_token (see slack_search).


Installation

packages:
  - git: https://github.com/getyourguide/abt-core.git
    revision: main
    subdirectory: packages/abt-slack-tools
abt deps

Credentials (profiles.yaml)

# profiles.yaml
default:
  target: dev
  outputs:
    dev:
      credentials:
        slack:
          bot_token: "{{ env_var('SLACK_BOT_TOKEN') }}"
          # user_token: "{{ env_var('SLACK_USER_TOKEN') }}"   # optional, enables workspace-wide slack_search

Tools

Every tool accepts a message permalink wherever it takes a conversation id, and takes times as ISO-8601 (2026-11-01 or 2026-11-01T09:30:00Z, UTC when no zone is given). Channel names such as #general are not accepted: Slack's API needs ids. Out-of-range numbers return an [ERROR] instead of being clamped. Errors name the Slack code and what to do about it (invite the bot, add a scope, wait out a rate limit).

Messages are written by other people, so the readers tell the model to treat them as data.

slack_search(
    query: str,
    channels: str = "",
    match_mode: Literal["phrase", "token"] = "phrase",
    limit: int = 10,
    after: str = "",
    before: str = "",
) -> str

Slack allows search.messages only for user tokens, so with a bot token the search is a keyword scan of conversations.history:

  • channels: up to 3 conversation ids (more is an error, not silently dropped). Each channel is read in pages of 200 messages, up to 5 pages, stopping once limit hits are found. after/before narrow the window.
  • Matching uses the whole message, including text that bots put in attachments and blocks.
  • Replies inside threads are not scanned. Open a hit with slack_thread_view.
  • The output ends with a [Coverage] note: messages scanned per channel, how far back, and whether older history exists. A rate limit mid-scan returns the hits found so far and says so.
match_mode Behavior
phrase (default) Case-insensitive substring of the full query
token Every whitespace-separated word in query must appear somewhere in the message

Workspace search. With credentials.slack.user_token (xoxp-…, scope search:read) and no channels, the tool calls search.messages as that user: Slack's own syntax (from:, in:) works, thread replies are included, and only what that user can see is searched. match_mode does not apply, and Slack's after:/before: operators take whole days, so the query is widened to days and the hits are trimmed back to the exact times.

Each hit shows the channel, time, permalink, author name (when the bot has users:read), excerpt, and channel_id / thread_ts for follow-up.

slack_thread_view

slack_thread_view(channel_id: str, thread_ts: str = "", limit: int = 100, cursor: str = "") -> str

Reads one thread via conversations.replies, one line per message: time, author name, text. <@U…> mentions become names, attached file names are listed. thread_ts may be 1712345678.123456, the p1712345678123456 form, or omitted when channel_id is a permalink. A thread longer than limit ends with a cursor for the next call.

If the bot is not a member of the channel, the tool returns an [ERROR] line that names the channel and the /invite @bot step.

slack_channel_history

slack_channel_history(channel: str, limit: int = 30, after: str = "", before: str = "", cursor: str = "") -> str

Reads the newest top-level messages of one conversation (conversations.history), shown oldest first, for "what happened in this channel during that window". Thread parents show their reply count and thread_ts. When older messages exist, the output ends with a cursor.

slack_post_message

slack_post_message(channel: str, text: str, thread_ts: str = "") -> str

Posts a message to a channel, or a reply when thread_ts is set. This is the package's only write tool, so it runs only when abt.yaml sets config.packages.abt-slack-tools.allow_writes: true (see Packages).

  • text is Slack mrkdwn, at most 40,000 characters.
  • <!channel>, <!here> and <!everyone> are rejected: an agent must not notify a whole channel on its own. <@USERID> is allowed.
  • The result gives the new message's ts, which is the thread_ts for replying to it. Slack posts an unknown thread_ts as an ordinary message, so take it from a hit.

Choosing source vs retriever vs tool

Need Use
Current incident thread at compile/run start Source type: slack_thread
Inject search at agent compile Retriever type: slack_search
Agent decides when to search or read mid-run slack_search / slack_thread_view / slack_channel_history tools
Post agent output to Slack Exposure type: slack (not these tools)

Retrievers and package tools share abt.integrations.slack.search.


Required Slack bot scopes

Feature API Scope(s)
slack_search (with channels), slack_channel_history conversations.history channels:history, groups:history, … (match channel types)
slack_thread_view / slack_thread source conversations.replies Same history scopes
Author names and mentions (optional) users.info users:read. Without it, ids are shown instead of names.
slack_search without channels search.messages User token with search:read
slack_post_message, exposure chat.postMessage chat:write

The bot must be invited to channels it reads. Apps not distributed through the Slack Marketplace, created after 29 May 2025, are limited by Slack to 1 conversations.history / conversations.replies request per minute and 15 messages per request; the tools follow the returned cursor, so they work, but slowly, and a rate-limited call says so. See Slack integration guide.


Example agent

tools:
  - slack__slack_search
  - slack__slack_thread_view
  - slack__slack_channel_history
User: What did we decide about remote Airflow pipelines in Slack last month?

Agent:
  slack_search("remote airflow pipelines", channels="C0MOCK00001", after="2026-10-01", before="2026-11-01")
  slack_thread_view("C0MOCK00001", "1704220800.123456")

Environment variables

Variable Default Description
ABT_TOOL_MAX_OUTPUT_BYTES 500 KB Per-tool output cap in bytes (the tools already stay under 75,000 characters)

See also