Skip to content

feat: support direct user ID lookup in users_search#263

Open
Christian-Sidak wants to merge 1 commit intokorotovsky:masterfrom
Christian-Sidak:feat/users-search-by-id
Open

feat: support direct user ID lookup in users_search#263
Christian-Sidak wants to merge 1 commit intokorotovsky:masterfrom
Christian-Sidak:feat/users-search-by-id

Conversation

@Christian-Sidak
Copy link
Copy Markdown

Summary

  • When the users_search query matches a Slack user ID pattern (starts with U or W, followed by alphanumeric characters, e.g. U07VCEPP4N5), the tool now calls the users.info API directly instead of performing a name/email search
  • Falls back to existing search behavior for non-ID queries
  • Updated tool description and parameter description to document user ID support

Motivation

When working with Slack data, user IDs appear frequently in message metadata, mentions (<@U07VCEPP4N5>), and API responses. Currently, resolving a user ID to a name/profile requires workarounds. This change lets you pass a user ID directly to users_search for an exact lookup.

Related: #205

Changes

  • pkg/provider/api.go: Added slackUserIDPattern regex and a user ID detection branch in SearchUsers() that calls the existing GetUsersInfo method (which wraps the Slack users.info API)
  • pkg/server/server.go: Updated tool and parameter descriptions to mention user ID support

Test plan

  • Query with a valid Slack user ID (e.g. U07VCEPP4N5) returns that user profile
  • Query with a name/email still uses the existing search path
  • Query with an invalid user ID format (e.g. hello, u07vcepp4n5) falls through to search
  • Works with both browser tokens (xoxc/xoxd) and OAuth tokens (xoxp/xoxb)

When the query matches a Slack user ID pattern (e.g., U07VCEPP4N5),
use the users.info API for direct lookup instead of searching by
name/email/display name. This is useful when you already have a
user ID (from message metadata, mentions, etc.) and need to resolve
it to user details.

Falls back to existing search behavior for non-ID queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants