Skip to main content
Glama

check_auth

Verify your current PingCode login status to access project management data through AI assistants.

Instructions

检查当前 PingCode 登录状态。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
      };
    }
  • 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';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ratatatat1/pingcode-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server