Skip to main content
Glama
MarveleE
by MarveleE

rap2_test_connection

Test connection to RAP2 API server and validate session by probing repository endpoints, automatically logging in if required.

Instructions

测试连接并校验会话:探测 /repository/joined,必要时自动登录后再探测(可用提示:"测试rap连接"、"确保已登录")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the rap2_test_connection tool: creates Rap2Client, probes /repository/joined endpoint, auto-logins if needed, returns {ok, status, didLogin} as JSON text.
    if (name === 'rap2_test_connection') {
      const client = createClient();
      const probe = async () => client._fetch('/repository/joined');
      let res = await probe();
      const looksLikeHtml = !!res?.data?.raw;
      const notOk = res?.status !== 200 || looksLikeHtml || res?.data?.isOk === false;
      let didLogin = false;
      if (notOk) {
        const login = await client.login();
        didLogin = !login?.error;
        res = await probe();
      }
      const ok = res?.status === 200 && !res?.data?.raw;
      const payload = { ok, status: res?.status ?? 0, didLogin };
      logger.info({ tool: name, result: payload }, 'tool success');
      return { content: [{ type: 'text', text: JSON.stringify(payload) }] };
    }
  • Tool metadata including name, description, and empty inputSchema (no parameters). Used for tool listing and validation.
      name: 'rap2_test_connection',
      description: '测试连接并校验会话:探测 /repository/joined,必要时自动登录后再探测(可用提示:\"测试rap连接\"、\"确保已登录\")',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Registers the tools list (including rap2_test_connection) in the MCP server's capabilities for tool discovery.
    const server = new Server(
      { name: 'rap2-mcp-tool', version: '0.1.9' },
      { capabilities: { tools: { list: tools } } },
    );

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/MarveleE/rap2-mcp'

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