Skip to main content
Glama
ww11-max

CSMAR MCP Server

by ww11-max

csmar_list_databases

Retrieve a list of CSMAR financial databases available to your account. Identify accessible datasets for financial research, including statements, trading data, and company information.

Instructions

列出用户有权访问的 CSMAR 数据库

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool registration for 'csmar_list_databases', which ensures login, calls the Python client's 'list_databases' action, and returns the result as formatted JSON.
    server.registerTool(
        'csmar_list_databases',
        {
            description: '列出用户有权访问的 CSMAR 数据库',
            inputSchema: {},
        },
        async () => {
            try {
                const loginResult = await ensureLogin();
                if (!loginResult.success) {
                    return { content: [{ type: 'text', text: JSON.stringify(loginResult, null, 2) }], isError: true };
                }
                
                const client = await initPythonClient();
                const result = await client.call('list_databases');
                return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
            } catch (error) {
                return { content: [{ type: 'text', text: `获取数据库列表错误: ${error.message}` }], isError: true };
            }
        }
    );
  • src/index.js:417-437 (registration)
    The 'csmar_list_databases' tool is registered via server.registerTool with an empty inputSchema and a handler that delegates to the Python backend.
    server.registerTool(
        'csmar_list_databases',
        {
            description: '列出用户有权访问的 CSMAR 数据库',
            inputSchema: {},
        },
        async () => {
            try {
                const loginResult = await ensureLogin();
                if (!loginResult.success) {
                    return { content: [{ type: 'text', text: JSON.stringify(loginResult, null, 2) }], isError: true };
                }
                
                const client = await initPythonClient();
                const result = await client.call('list_databases');
                return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
            } catch (error) {
                return { content: [{ type: 'text', text: `获取数据库列表错误: ${error.message}` }], isError: true };
            }
        }
    );
  • Input schema for the tool: an empty object (no parameters required), with a description '列出用户有权访问的 CSMAR 数据库'.
    {
        description: '列出用户有权访问的 CSMAR 数据库',
        inputSchema: {},
  • The Python backend handler (get_list_dbs) that calls csmar.getListDbs() and returns the database list.
    def get_list_dbs(self) -> Dict[str, Any]:
        try:
            csmar = self._ensure_csmar()
            databases = csmar.getListDbs()
            if databases is None:
                return {"success": False, "error": "数据库列表为空 (可能是权限不足或网络问题)", "databases": [], "count": 0}
    
            db_list = list(databases) if hasattr(databases, '__iter__') else [str(databases)]
            return {"success": True, "databases": db_list, "count": len(db_list)}
        except Exception as e:
            return {"success": False, "error": f"获取数据库列表失败: {str(e)}"}
  • The command dispatcher that maps the 'list_databases' action string to client.get_list_dbs() when received from the Node.js process.
    def handle_command(command: Dict[str, Any], client: CSMARClient) -> Dict[str, Any]:
        action = command.get("action")
        params = command.get("params", {})
    
        handlers = {
            "login": lambda: client.login(
                params.get("account", ""), params.get("pwd", ""), params.get("lang", "0")
            ),
            "list_databases": lambda: client.get_list_dbs(),
            "list_tables": lambda: client.get_list_tables(params.get("database_name", "")),
            "list_fields": lambda: client.get_list_fields(params.get("table_name", "")),
            "query_count": lambda: client.query_count(
                params.get("columns", []), params.get("condition", ""), params.get("table_name", ""),
                params.get("start_time"), params.get("end_time")
            ),
            "query": lambda: client.query(
                params.get("columns", []), params.get("condition", ""), params.get("table_name", ""),
                params.get("start_time"), params.get("end_time"), params.get("format", "json"), params.get("limit")
            ),
            "preview": lambda: client.preview(params.get("table_name", "")),
            "check_availability": lambda: {
                "success": True,
                "csmar_available": CSMAR_AVAILABLE,
                "client_logged_in": client.logged_in,
                "username": client.username,
                "sdk_error": _sdk_error if not CSMAR_AVAILABLE else None
            },
            "reset": lambda: client.reset() or {"success": True, "message": "已重置"}
        }
    
        handler = handlers.get(action)
        if handler:
            return handler()
    
        return {"success": False, "error": f"未知动作: {action}", "supported_actions": list(handlers.keys())}
Behavior2/5

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

No annotations are present, so the description carries full responsibility for behavioral disclosure. It does not mention whether authentication is required, error behavior, or if the operation is read-only. Since this is a list operation, it is likely safe, but the description does not confirm this.

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

Conciseness5/5

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

The description is a single, concise sentence that conveys the essential purpose without any superfluous words.

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

Completeness3/5

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

While the description covers the basic purpose, it lacks context about preconditions (e.g., does the user need to be logged in via csmar_login?) and the nature of the output. Given no output schema, some description of the return format would improve completeness.

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

Parameters4/5

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

There are no parameters, so the input schema is trivially covered. The description does not need to add parameter meaning. Baseline for zero parameters is 4.

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?

The description clearly states the verb 'list' and the resource 'databases', specifying 'that the user has access to'. This distinguishes it from siblings like csmar_list_tables and csmar_list_fields, which list different entities.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool compared to alternatives. With siblings like csmar_list_fields and csmar_list_tables, explicit usage context would help an agent decide which list tool to invoke.

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/ww11-max/CSMAR-MCP'

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