Skip to main content
Glama

register

Register a client account to obtain an API key for accessing the OpenAaaS scientific agent network. One-time registration required.

Instructions

注册客户端账号,获取 api_key(仅需一次)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
serverNodefault

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'register'. It is decorated with @mcp.tool() and defines the register function that: validates the name parameter, checks for existing registration, calls POST /api/v1/client/auth/register on the server, saves the api_key to config, and returns a success/error message.
    # ------------------------------------------------------------------
    @mcp.tool()
    def register(name: str, server: str = "default") -> str:
        """注册客户端账号,获取 api_key(仅需一次)"""
        name = name.strip()
        if not name:
            return "❌ 缺少必填参数: name"
        if len(name) > 64:
            return "❌ 参数错误: name 长度不能超过 64 字符"
        if re.search(r'[\x00-\x1f/\\<>|&;$]', name):
            return "❌ 参数错误: name 包含非法字符"
        if any(unicodedata.category(c).startswith('C') for c in name):
            return "❌ 参数错误: name 包含非法字符(Unicode 控制字符)"
    
        try:
            sc = get_server_config(server)
        except RuntimeError as e:
            return f"❌ {e}"
    
        alias = sc["alias"]
        server_url = strip_trailing_slash(sc.get("server_url", ""))
        if not server_url:
            return "❌ 服务器地址未配置,请先使用 set_server_url 设置"
    
        # 已注册检查
        if sc.get("api_key"):
            return (
                f"✅ 已注册,无需重复注册。\n"
                f"服务器别名: {alias}\n"
                f"服务器地址: {server_url}\n"
                f"客户端 ID: {sc.get('client_id', 'unknown')}\n"
                f"用户名: {sc.get('name', 'unknown')}\n\n"
                "如需修改用户名,请使用 update_profile。\n"
                "如需切换到其他服务器,请先用 set_server_url 修改地址,再重新注册。"
            )
    
        # 检查其他 alias 是否已用相同 URL 注册
        config = load_config()
        for other_alias, other_srv in config.get("servers", {}).items():
            if other_alias == alias:
                continue
            other_url = strip_trailing_slash(other_srv.get("server_url", ""))
            if other_url == server_url and other_srv.get("api_key"):
                return (
                    "❌ 该服务器地址已被其他别名注册过。\n"
                    f"服务器别名: {other_alias}\n"
                    f"服务器地址: {other_srv.get('server_url')}\n"
                    f"客户端 ID: {other_srv.get('client_id', 'unknown')}\n"
                    f"用户名: {other_srv.get('name', 'unknown')}\n\n"
                    "如需使用其他别名,请先使用 remove_server 删除已有配置。"
                )
    
        url = f"{server_url}/api/v1/client/auth/register"
        try:
            result = safe_request("POST", url, data={"name": name})
        except OpenAaaSError as e:
            return f"❌ 注册失败: {e}"
    
        api_key = result.get("api_key") or result.get("token")
        client_id = result.get("client_id") or result.get("id")
    
        if api_key:
            config = load_config()
            servers = config.setdefault("servers", {})
            if alias not in servers:
                servers[alias] = {}
            servers[alias]["api_key"] = api_key
            if client_id:
                servers[alias]["client_id"] = client_id
            servers[alias]["name"] = name
            servers[alias]["server_url"] = server_url
            save_config(config)
            saved = True
        else:
            saved = False
    
        return (
            f"✅ 注册成功!服务器: {alias},客户端 ID: {client_id}。\n"
            f"API Key 已{'自动保存' if saved else '返回,请手动保存'}到 config.json"
        )
  • Input schema for the register tool: parameters are 'name' (str, required) and 'server' (str, default='default'), validated inline (non-empty, max 64 chars, no illegal chars).
    @mcp.tool()
    def register(name: str, server: str = "default") -> str:
  • The entry point that creates a FastMCP instance and calls register_tools(mcp), which registers all tools including 'register'.
    import sys
    from fastmcp import FastMCP
    from .tools import register_tools
    
    
    def main() -> None:
        mcp = FastMCP("openaaas-mcp-adapter")
        register_tools(mcp)
  • The register_tools function itself, which is called from __main__.py to register all MCP tools on the FastMCP instance.
    def register_tools(mcp: FastMCP) -> None:
        """注册所有 OpenAaaS MCP Tools"""
  • Export of the register function in the client-app Vue store (server.ts). This is a frontend register function that calls the same API endpoint.
    register,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool registers an account and gets an api_key, but does not disclose behavior like whether re-registration overwrites existing keys, or any side effects. The note 'only needed once' hints at irreversibility but is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence, which is concise and front-loaded, but it lacks detail. While concise, it could be more informative without being verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the moderate complexity (2 parameters, output schema exists), the description is incomplete. It does not mention prerequisites (e.g., server setup), what the api_key is used for, or confirm the output contains the key. Sibling tools like set_server_url suggest dependencies not addressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds no meaning to the parameters 'name' or 'server'. It does not explain what 'name' represents or how 'server' defaults to 'default'. The description provides no semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool registers a client account and obtains an api_key. It includes a usage note that this is only needed once. This distinguishes it from sibling tools which deal with tasks, files, servers, etc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly mentions 'only needed once', indicating this is a one-time setup operation. It does not explicitly state when not to use it, but the sibling tool names suggest distinct purposes, so the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Wolido/OpenAaaS'

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