check_auth
Verify your current PingCode login status to access project management data through AI assistants.
Instructions
检查当前 PingCode 登录状态。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/login.ts:178-202 (handler)The core handler function for the 'check_auth' tool. It loads stored credentials, validates them using isCredentialsValid, and returns the authentication status along with an optional expiration time.export function checkAuth(): { authenticated: boolean; message: string; expiresAt?: string; } { const credentials = loadCredentials(); const isValid = isCredentialsValid(credentials); if (!isValid) { return { authenticated: false, message: '未登录或凭证已过期,请调用 login 工具进行登录', }; } const expiresAt = credentials!.expires_at ? new Date(credentials!.expires_at).toLocaleString('zh-CN') : '未知'; return { authenticated: true, message: '已登录', expiresAt, }; }
- src/index.ts:49-57 (registration)Registration of the 'check_auth' tool in the ListToolsRequestSchema handler, defining its name, description, and empty input schema.{ name: 'check_auth', description: '检查当前 PingCode 登录状态。', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:192-207 (registration)Tool dispatch logic in the CallToolRequestSchema handler. It invokes the checkAuth function and formats the response for the MCP server.case 'check_auth': { const result = checkAuth(); let text = result.message; if (result.authenticated && result.expiresAt) { text += `\n凭证过期时间: ${result.expiresAt}`; } return { content: [ { type: 'text', text, }, ], isError: !result.authenticated, }; }
- src/index.ts:52-56 (schema)Input schema for the 'check_auth' tool, specifying no required properties.inputSchema: { type: 'object', properties: {}, required: [], },
- src/index.ts:9-9 (registration)Import statement bringing the checkAuth handler into the main server file.import { login, logout, checkAuth } from './tools/login.js';