get_contacts
Retrieve your contacts to enable task sharing and collaboration within Remember The Milk.
Instructions
Get contacts for task sharing.
Returns: List of contacts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/rtm_mcp/tools/utilities.py:266-298 (handler)The actual handler function for the 'get_contacts' tool. Calls rtm.contacts.getList API, processes the contact data (normalizing single dict to list), and returns a structured response with contacts and count.
@mcp.tool() async def get_contacts(ctx: Context) -> dict[str, Any]: """Get contacts for task sharing. Returns: List of contacts """ from ..client import RTMClient client: RTMClient = await get_client() result = await client.call("rtm.contacts.getList") contacts_data = result.get("contacts", {}).get("contact", []) if isinstance(contacts_data, dict): contacts_data = [contacts_data] contacts = [] for contact in contacts_data: contacts.append( { "id": contact.get("id"), "fullname": contact.get("fullname"), "username": contact.get("username"), } ) return build_response( data={ "contacts": contacts, "count": len(contacts), }, ) - src/rtm_mcp/tools/utilities.py:10-10 (registration)The registration function 'register_utility_tools' that wraps all utility tools including get_contacts (using @mcp.tool() decorator on line 266).
def register_utility_tools(mcp: Any, get_client: Any) -> None: - src/rtm_mcp/server.py:106-106 (registration)Tool registration call in server.py that invokes register_utility_tools(mcp, get_client) to register get_contacts and other utility tools.
register_utility_tools(mcp, get_client) - src/rtm_mcp/server.py:15-16 (registration)Import of register_utility_tools from tools package in server.py.
register_utility_tools, ) - src/rtm_mcp/response_builder.py:7-35 (helper)The build_response helper used by get_contacts to format the structured response with data and metadata.
def build_response( data: dict[str, Any] | list[Any], analysis: dict[str, Any] | None = None, transaction_id: str | None = None, ) -> dict[str, Any]: """Build a consistent response structure. Args: data: The main response data analysis: Optional analysis/insights transaction_id: Optional transaction ID for undo support Returns: Structured response dict """ response = { "data": data, "metadata": { "fetched_at": datetime.now().isoformat(), }, } if analysis: response["analysis"] = analysis if transaction_id: response["metadata"]["transaction_id"] = transaction_id return response