wecom-cli is a tool provided by the plugin, not a terminal command: all operations are completed by calling this tool, and parameters should use args to pass in. It is forbidden to use it through command-line methods such as exec / shell / terminal.
⚠️ Prerequisite: Before calling wecom-cli for the first time, you must perform the prerequisite check according to the wecomcli-preflight skill to ensure the tool has been added to the allowlist.
WeCom contact searchUse wecom-cli to search for people in the WeCom contacts by keyword.
Interface
Batch fuzzy search for people by keyword, with a maximum of 10 keywords at a time, returning the hit users array (name / English name / position / department). Fields that keywords can match include: name (username), name pinyin, English name, and alias, and are not limited to Chinese names and aliases.
How to call
Use the wecom-cli tool to call it in the following format
wecom-cli contact users search --json '<JSON 参数>'
Parameters
| Field | Type | Required | Default value | Meaning |
|---|---|---|---|---|
keywords |
string[] | Yes | — | List of search keywords, matchable by name (username) / pinyin / English name / alias, up to 10; multiple keywords are in an OR relationship |
search_mode |
string | No | — | Search mode. By default, do not pass this parameter; only when you need to get the complete personnel list should you explicitly pass "list" |
- Default (do not pass
search_mode): return the most relevant candidate results, used for routine scenarios of searching for a single person by name / pinyin, etc.; the vast majority of scenarios go through this branch. - Pass
search_mode = "list": return the full list of hits. Pass this only when the user explicitly wants the "complete list", with typical wording such as "how many Zhang San are there in total / all people named Li Si / list all people with the same name / all people with the same name" and other counting or exhaustive intent; in this case, it is not subject to the "first 5" display limit.
Return
| Field | Type | Description |
|---|---|---|
users |
array | List of hit users |
users[].userid |
string | Unique user identifier |
users[].name |
string | Chinese name |
users[].alias |
string | English name / alias (may be empty) |
users[].email |
string | Email (may be empty) |
users[].position |
string | Management position (such as "person in charge"),not"job title" (may be empty) |
users[].matched_keywords |
string[] | The requested keyword hit by this user |
users[].departments |
string[] | List of department paths where the user belongs (from largest to smallest), with the primary department first |
hint |
string | Result limit notice (may be empty): when the hit results for a keyword are not fully returned due to a limit, the interface will provide an explanation in this field |
users_count |
integer | users Number of array elements |
Usage rules
- Ambiguity display limit: when there are more than 5 candidates under the same keyword, only the first 5 are displayed (with distinguishing information such as name / English name / position), and the user is told "if the target is not among them, you can ask to 'view more'"; expand the next batch only when the user explicitly requests it;
- Display order: must be displayed strictly in the original order of the
usersarray returned by the interface. Do not randomly sort, rearrange, or shuffle the order yourself. - Result limitation notice: When the hint field in the response is non-empty, you must inform the user in your reply that "the current returned content is limited; only partial results were returned," and you may explain the reason for the limitation based on the hint content.
Missing parameter
When required parameters are missing (no search keywords provided) and the context cannot be used to infer them, ask the user for the missing information in concise natural language; do not guess default values.