Skip to main content
Glama
ww11-max

CSMAR MCP Server

by ww11-max

csmar_list_tables

Retrieve all table names within any CSMAR financial database by specifying the database name. Quickly understand database structure for financial research.

Instructions

列出指定数据库中的所有表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes数据库名称

Implementation Reference

  • The MCP tool handler for 'csmar_list_tables'. It ensures login, then calls the Python client via client.call('list_tables', { database_name }) and returns the result as JSON text.
        async ({ database_name }) => {
            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_tables', { database_name });
                return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
            } catch (error) {
                return { content: [{ type: 'text', text: `获取表列表错误: ${error.message}` }], isError: true };
            }
        }
    );
  • Input schema definition for the csmar_list_tables tool: requires a 'database_name' string parameter.
    {
        description: '列出指定数据库中的所有表',
        inputSchema: {
            database_name: z.string().describe('数据库名称'),
        },
    },
  • src/index.js:440-462 (registration)
    Registration of the tool 'csmar_list_tables' via server.registerTool with its description, inputSchema, and handler.
    server.registerTool(
        'csmar_list_tables',
        {
            description: '列出指定数据库中的所有表',
            inputSchema: {
                database_name: z.string().describe('数据库名称'),
            },
        },
        async ({ database_name }) => {
            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_tables', { database_name });
                return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
            } catch (error) {
                return { content: [{ type: 'text', text: `获取表列表错误: ${error.message}` }], isError: true };
            }
        }
    );
  • The Python-side handler (get_list_tables) that calls the CSMAR SDK's getListTables() for the given database_name and returns the table list.
    def get_list_tables(self, database_name: str) -> Dict[str, Any]:
        try:
            csmar = self._ensure_csmar()
            tables = csmar.getListTables(database_name)
            if tables is None:
                return {"success": False, "error": f"表列表为空 (数据库: {database_name})", "tables": [], "count": 0}
            table_list = list(tables) if hasattr(tables, '__iter__') else [str(tables)]
            return {"success": True, "database": database_name, "tables": table_list, "count": len(table_list)}
        except Exception as e:
            return {"success": False, "error": f"获取表列表失败: {str(e)}"}
  • Command dispatcher that routes the 'list_tables' action to CSMARClient.get_list_tables() with the database_name parameter.
    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", "")),
Behavior2/5

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

With no annotations provided, the description carries full burden. It only states 'list tables' without disclosing any behavioral traits (e.g., read-only, error handling, side effects). This is insufficient for a tool with no annotation coverage.

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

Conciseness4/5

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

The description is a single, short sentence that efficiently conveys the core purpose. However, it could add more context without becoming verbose, hence not a 5.

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?

For a simple tool with one parameter and no output schema, the description is minimally adequate. It explains what it does and the parameter, but lacks details on return format, error cases, or behavior, leaving gaps.

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

Parameters3/5

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

Schema coverage is 100%, and the parameter 'database_name' has a description in the schema. The tool description does not add any extra semantic value beyond the schema; baseline 3 is appropriate.

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 tool's action (list tables) and scope (in a specified database). It distinguishes from siblings like csmar_list_databases (lists databases) and csmar_list_fields (lists fields).

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 on when to use this tool vs alternatives, such as prerequisites or context. The description merely states the action without contextual usage advice.

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