Skip to main content
Glama
ww11-max

CSMAR MCP Server

by ww11-max

csmar_health_check

Verifies the health and connectivity of CSMAR services before executing database queries, ensuring reliable access to financial data.

Instructions

检查 CSMAR 服务健康状态

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.js:360-392 (registration)
    Registers the 'csmar_health_check' MCP tool with no input schema. The handler calls checkAvailability() and checkLoginStatus() and returns a JSON result with python_client, csmar_sdk, logged_in, username, api_base, and version fields.
    // 1. 健康检查工具
    server.registerTool(
        'csmar_health_check',
        {
            description: '检查 CSMAR 服务健康状态',
            inputSchema: {},
        },
        async () => {
            try {
                const availability = await checkAvailability();
                const loginStatus = await checkLoginStatus();
                
                return {
                    content: [{
                        type: 'text',
                        text: JSON.stringify({
                            python_client: availability.csmar_available ? '可用' : '不可用',
                            csmar_sdk: availability.csmar_available ? '已安装' : '未安装',
                            logged_in: loginStatus.logged_in,
                            username: loginStatus.username,
                            api_base: CONFIG.apiBase,
                            version: CONFIG.version
                        }, null, 2)
                    }]
                };
            } catch (error) {
                return {
                    content: [{ type: 'text', text: `健康检查失败: ${error.message}` }],
                    isError: true
                };
            }
        }
    );
  • The anonymous async handler function that executes the health check logic. It calls checkAvailability() and checkLoginStatus() helper functions and formats the health status response.
        async () => {
            try {
                const availability = await checkAvailability();
                const loginStatus = await checkLoginStatus();
                
                return {
                    content: [{
                        type: 'text',
                        text: JSON.stringify({
                            python_client: availability.csmar_available ? '可用' : '不可用',
                            csmar_sdk: availability.csmar_available ? '已安装' : '未安装',
                            logged_in: loginStatus.logged_in,
                            username: loginStatus.username,
                            api_base: CONFIG.apiBase,
                            version: CONFIG.version
                        }, null, 2)
                    }]
                };
            } catch (error) {
                return {
                    content: [{ type: 'text', text: `健康检查失败: ${error.message}` }],
                    isError: true
                };
            }
        }
    );
  • Helper function that initializes the Python client and sends a 'check_availability' command to the Python process to check if CSMAR SDK is available.
    async function checkAvailability() {
        try {
            const client = await initPythonClient();
            return await client.call('check_availability');
        } catch (error) {
            return { success: false, csmar_available: false, error: error.message };
        }
    }
  • Helper function that wraps checkAvailability() to extract login status fields (logged_in, username) from the availability check result.
    async function checkLoginStatus() {
        const result = await checkAvailability();
        return {
            success: result.success,
            csmar_available: result.csmar_available,
            logged_in: result.client_logged_in,
            username: result.username,
            message: result.message || '检查登录状态成功'
        };
    }
  • The Python-side handler for the 'check_availability' action. Returns the SDK availability flag, client login status, username, and any SDK import error.
    "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
    },
Behavior3/5

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

Without annotations, the description is minimal. It implies a read-only check but lacks details on what constitutes 'healthy' or potential effects if the service is down. However, for a health check tool, the behavior is somewhat self-evident.

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, front-loaded sentence with no extraneous information, efficiently conveying the tool's purpose.

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

Completeness4/5

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

Given the simplicity (no parameters, no output schema), the description is largely complete for understanding the tool's function. It could be enhanced by mentioning the expected output (e.g., a status string), but it is sufficient.

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 description does not need to add parameter meaning. The baseline for 0 parameters is 4, and the description adequately covers the absence of inputs.

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 checks CSMAR service health status, using a specific verb and resource. It distinguishes itself from sibling tools that deal with data operations like listing databases or querying.

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 given on when to use this tool versus alternatives, such as using it as a prerequisite before other operations or when service issues are suspected.

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