get_accounts
Retrieve balance and asset details for Upbit accounts using a dedicated tool integrated with the Upbit MCP Server. Access your cryptocurrency holdings and manage account information efficiently.
Instructions
업비트 계정의 잔고 정보를 조회합니다.
Returns:
list[dict]: 보유 중인 자산 목록
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/get_accounts.py:5-35 (handler)The handler function that implements the get_accounts tool. It queries the Upbit API for account balances, handles authentication, errors, and returns a list of account dictionaries.async def get_accounts(ctx: Context = None) -> list[dict]: """ 업비트 계정의 잔고 정보를 조회합니다. Returns: list[dict]: 보유 중인 자산 목록 """ if not UPBIT_ACCESS_KEY: if ctx: ctx.error("API 키가 설정되지 않았습니다. .env 파일에 UPBIT_ACCESS_KEY와 UPBIT_SECRET_KEY를 설정해주세요.") return [{"error": "API 키가 설정되지 않았습니다."}] url = f"{API_BASE}/accounts" headers = { "Authorization": f"Bearer {generate_upbit_token()}" } if ctx: ctx.info("계정 잔고 조회 중...") async with httpx.AsyncClient() as client: try: res = await client.get(url, headers=headers) if res.status_code != 200: if ctx: ctx.error(f"업비트 API 오류: {res.status_code} - {res.text}") return [{"error": f"업비트 API 오류: {res.status_code}"}] return res.json() except Exception as e: if ctx: ctx.error(f"API 호출 중 오류 발생: {str(e)}") return [{"error": f"API 호출 중 오류 발생: {str(e)}"}]
- main.py:45-45 (registration)Registration of the get_accounts tool using the FastMCP decorator.mcp.tool()(get_accounts)