SuperAPI AI Directory

wecom-contact-lookup

Office & productivity

View repository

Updated 10-16 08:47

About this skill

Contact member query skill

wecom_mcp is an MCP tool, and all operations are completed by calling this tool.

⚠️ Prerequisites: Before the first call to wecom_mcp , you must follow the wecom-preflight skill to perform the prerequisite check to ensure the tool has been added to the allowlist.

Encapsulated through the MCP tool protocol, the get_userlist interface retrieves contact members within the range visible to the current user and performs local filtering and matching by name/alias.

Operations

1. Retrieve all contact members

Retrieve information for all enterprise members within the range visible to the current user:

Call example:

Use the wecom_mcp tool to call wecom_mcp call contact get_userlist '{}'

Return format:

{
    "errcode": 0,
    "errmsg": "ok",
    "userlist": [
        {
            "userid": "zhangsan",
            "name": "张三",
            "alias": "Sam"
        },
        {
            "userid": "lisi",
            "name": "李四",
            "alias": ""
        }
    ]
}

Return field description:

Field Type Description
errcode integer Return code,0 indicates success
errmsg string Error message
userlist array User list
userlist[].userid string User unique ID
userlist[].name string User name
userlist[].alias string User alias, may be empty

2. Search for personnel by name/alias

get_userlist After all members are returned, filter and match the results locally:

  • Exact match:name or alias is exactly the same as the keyword, use it directly
  • Fuzzy match:name or alias contains the keyword, return all matching results
  • No results: Inform the user that no corresponding person was found

Search example:

User asks: "Help me find out who Zhang San is?"

  1. Call get_userlist to retrieve all members
  2. In userlist , filter members whose name or alias contains "Zhang San"
  3. Return matching results

Notes

  • get_userlist What is returned is the current user'svisible rangemembers, which need to be filtered by visibility rules and are not necessarily all personnel in the entire company; the returned fields only include userid、name(name) and alias(alias)

  • ⚠️ The API will report an error when there are more than 10 people: If userlist returns more than 10 members, it is considered abnormal; processing should be stopped immediately and the user should be informed:

    The number of visible members in the current contacts exceeds the upper limit supported by this skill (10 people). This skill is only applicable to scenarios with a small visible range and cannot be used in a large-range contacts list. It is recommended to narrow the visible range and try again, or query the target personnel through other methods.

  • userid is the user's unique identifier, use this field when the user ID needs to be passed to other interfaces

  • alias The field may be an empty string, and a null value check is required when searching

  • If the search results contain multiple people with the same name, all candidates must be shown to the user for selection and you must not decide on your own

  • If errcode is not 0, it indicates that the API call failed, and the user needs to be informed of the error message (errmsg)


Typical workflow

Workflow 1: Query personnel information

User asks: "Help me look up who Sam is?"

  1. Use wecom_mcp tool to call wecom_mcp call contact get_userlist '{}' to get the full member list

  2. Filter in the results for alias is Sam or name contains Sam members

  3. If a unique match is found, display the result directly:

📇 找到成员:
- 姓名:张三
- 别名:Sam
- 用户ID:zhangsan
  1. If multiple matches are found, display the candidate list and ask the user to confirm:
🔍 找到多个匹配成员,请确认您要查询的是哪位:

1. 张三(别名:Sam,ID:zhangsan)
2. 张三丰(别名:Sam2,ID:zhangsan2)

请问您要查询的是哪一位?

Workflow 2: Provide userid conversion for other features

User asks: "Help me send a message to Zhang San"

  1. Use wecom_mcp tool to call wecom_mcp call contact get_userlist '{}' to get all members

  2. Filter for members whose name is "Zhang San", confirm userid

  3. Pass userid to the message sending interface


Workflow 3: Batch query multiple personnel

User asks: "Help me look up who Zhang San and Li Si are respectively?"

  1. Use wecom_mcp tool to call wecom_mcp call contact get_userlist '{}' to get the full member list

  2. Filter the match results for "Zhang San" and "Li Si" respectively

  3. Aggregate and display together

Note: only call get_userlistonce, and perform multiple filters on the results locally to avoid repeated interface calls.


Quick reference

Interface description

Interface Purpose Input Return
get_userlist Get all contacts members within the visible range None User list (userid, name, alias)

Local filtering strategy

Scenario Strategy
Exact match (name or alias exactly matches) Use directly, no user confirmation needed
Fuzzy match (name or alias contains the keyword), unique result Use directly, display the result to the user
Fuzzy match, multiple results Display the candidate list and ask the user to choose
No matching result Inform the user that no corresponding person was found