Skip to main content
Glama
24mlight

A Share MCP

by 24mlight

list_tool_constants

Retrieve valid parameter constants for A-share market data tools, including frequency types, adjustment flags, year formats, and index identifiers.

Instructions

    List valid constants for tool parameters.

    Args:
        kind: Optional filter: 'frequency' | 'adjust_flag' | 'year_type' | 'index'. If None, show all.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNo

Implementation Reference

  • Core handler function decorated with @app.tool(). Lists valid constants (frequency, adjust_flag, year_type, index) filtered by optional 'kind' parameter. Formats output as Markdown tables.
    def list_tool_constants(kind: Optional[str] = None) -> str:
        """
        List valid constants for tool parameters.
    
        Args:
            kind: Optional filter: 'frequency' | 'adjust_flag' | 'year_type' | 'index'. If None, show all.
        """
        logger.info("Tool 'list_tool_constants' called kind=%s", kind or "all")
        freq = [
            ("d", "daily"), ("w", "weekly"), ("m", "monthly"),
            ("5", "5 minutes"), ("15", "15 minutes"), ("30", "30 minutes"), ("60", "60 minutes"),
        ]
        adjust = [("1", "forward adjusted"), ("2", "backward adjusted"), ("3", "unadjusted")]
        year_type = [("report", "announcement year"), ("operate", "ex-dividend year")]
        index = [("hs300", "CSI 300"), ("sz50", "SSE 50"), ("zz500", "CSI 500")]
    
        sections = []
    
        def as_md(title: str, rows):
            if not rows:
                return ""
            header = f"### {title}\n\n| value | meaning |\n|---|---|\n"
            lines = [f"| {v} | {m} |" for (v, m) in rows]
            return header + "\n".join(lines) + "\n"
    
        k = (kind or "").strip().lower()
        if k in ("", "frequency"):
            sections.append(as_md("frequency", freq))
        if k in ("", "adjust_flag"):
            sections.append(as_md("adjust_flag", adjust))
        if k in ("", "year_type"):
            sections.append(as_md("year_type", year_type))
        if k in ("", "index"):
            sections.append(as_md("index", index))
    
        out = "\n".join(s for s in sections if s)
        if not out:
            return "Error: Invalid kind. Use one of 'frequency', 'adjust_flag', 'year_type', 'index'."
        return out
  • @app.tool() decorator registers the list_tool_constants function as an MCP tool within the register_helpers_tools function.
    @app.tool()
    def list_tool_constants(kind: Optional[str] = None) -> str:
  • mcp_server.py:58-58 (registration)
    Top-level call to register_helpers_tools(app), which includes registration of list_tool_constants among helper tools.
    register_helpers_tools(app)
  • Helper function that registers multiple utility tools, including list_tool_constants, with the FastMCP app instance.
    def register_helpers_tools(app: FastMCP):
        """Register helper/utility tools with the MCP app."""
    
        @app.tool()
        def normalize_stock_code(code: str) -> str:
            """Normalize a stock code to Baostock format."""
            logger.info("Tool 'normalize_stock_code' called with input=%s", code)
            return run_tool_with_handling(
                lambda: normalize_stock_code_logic(code),
                context="normalize_stock_code",
            )
    
        @app.tool()
        def normalize_index_code(code: str) -> str:
            """Normalize common index codes to Baostock format."""
            logger.info("Tool 'normalize_index_code' called with input=%s", code)
            return run_tool_with_handling(
                lambda: normalize_index_code_logic(code),
                context="normalize_index_code",
            )
    
        @app.tool()
        def list_tool_constants(kind: Optional[str] = None) -> str:
            """
            List valid constants for tool parameters.
    
            Args:
                kind: Optional filter: 'frequency' | 'adjust_flag' | 'year_type' | 'index'. If None, show all.
            """
            logger.info("Tool 'list_tool_constants' called kind=%s", kind or "all")
            freq = [
                ("d", "daily"), ("w", "weekly"), ("m", "monthly"),
                ("5", "5 minutes"), ("15", "15 minutes"), ("30", "30 minutes"), ("60", "60 minutes"),
            ]
            adjust = [("1", "forward adjusted"), ("2", "backward adjusted"), ("3", "unadjusted")]
            year_type = [("report", "announcement year"), ("operate", "ex-dividend year")]
            index = [("hs300", "CSI 300"), ("sz50", "SSE 50"), ("zz500", "CSI 500")]
    
            sections = []
    
            def as_md(title: str, rows):
                if not rows:
                    return ""
                header = f"### {title}\n\n| value | meaning |\n|---|---|\n"
                lines = [f"| {v} | {m} |" for (v, m) in rows]
                return header + "\n".join(lines) + "\n"
    
            k = (kind or "").strip().lower()
            if k in ("", "frequency"):
                sections.append(as_md("frequency", freq))
            if k in ("", "adjust_flag"):
                sections.append(as_md("adjust_flag", adjust))
            if k in ("", "year_type"):
                sections.append(as_md("year_type", year_type))
            if k in ("", "index"):
                sections.append(as_md("index", index))
    
            out = "\n".join(s for s in sections if s)
            if not out:
                return "Error: Invalid kind. Use one of 'frequency', 'adjust_flag', 'year_type', 'index'."
            return out
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 mentions listing constants but doesn't disclose behavioral traits like whether it's read-only, the format of returned data, potential rate limits, or authentication needs. This leaves significant gaps for a tool that likely provides reference data.

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 appropriately sized and front-loaded, with a clear purpose statement followed by parameter details in two sentences. There is no wasted text, making it efficient and easy to parse.

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?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the purpose and parameter semantics well, but lacks behavioral context and usage guidelines, which are important for a reference tool in a financial data context.

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?

With 0% schema description coverage and 1 parameter, the description compensates well by explaining the 'kind' parameter as an optional filter with specific values ('frequency', 'adjust_flag', 'year_type', 'index') and default behavior (show all if None). This adds meaningful semantics beyond the bare schema.

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

Purpose4/5

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

The description clearly states the tool's purpose with the verb 'List' and resource 'valid constants for tool parameters', making it specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_index_constituents' or 'list_industries' that might also list data, though their domains differ.

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?

The description provides no guidance on when to use this tool versus alternatives, such as for parameter validation or data lookup. It mentions an optional filter but doesn't explain scenarios where filtering is beneficial or when to use other tools for similar purposes.

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/24mlight/a-share-mcp-is-just-i-need'

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