Skip to main content
Glama
JJVvV

SP Database MCP Server

by JJVvV

get_table_documentation

Retrieve detailed documentation for database tables to understand structure, columns, and relationships for development or analysis purposes.

Instructions

获取表的详细文档说明

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes表名

Implementation Reference

  • Registration of the 'get_table_documentation' tool including its description and input schema.
    Tool(
        name="get_table_documentation",
        description="获取表的详细文档说明",
        inputSchema={
            "type": "object",
            "properties": {"table_name": {"type": "string", "description": "表名"}},
            "required": ["table_name"],
        },
    ),
  • Main handler logic for the 'get_table_documentation' tool: validates input, fetches table info and documentation via API client, formats the output.
    elif name == "get_table_documentation":
        table_name = arguments.get("table_name")
    
        if not table_name:
            return [TextContent(type="text", text="错误:缺少表名参数")]
    
        # 首先尝试获取表信息
        table_info = await _get_table_info(table_name, "auto")
        if not table_info:
            return [
                TextContent(type="text", text=f"未找到表 '{table_name}' 的信息")
            ]
    
        # 如果有 API 客户端,尝试获取文档
        documentation = ""
        if api_client:
            try:
                documentation = await api_client.get_table_documentation(table_name)
            except Exception as e:
                print(f"Error getting documentation: {e}")
    
        # 生成完整的文档
        output = _format_table_documentation(table_info, documentation)
        return [TextContent(type="text", text=output)]
  • Helper function in APIClient that performs the HTTP request to retrieve table documentation from the backend API.
    async def get_table_documentation(self, table_name: str) -> Optional[str]:
        """获取表的文档说明"""
        try:
            async with httpx.AsyncClient() as client:
                response = await client.get(
                    f"{self.base_url}/api/database/tables/{table_name}/docs",
                    headers=self.headers,
                    timeout=30.0,
                )
    
                if response.status_code == 200:
                    data = response.json()
                    return data.get("documentation", "")
                else:
                    return None
    
        except httpx.RequestError as e:
            print(f"API request error: {e}")
            return None
  • Helper function that formats the complete table documentation by combining table structure info and additional documentation.
    def _format_table_documentation(
        table_info: TableInfo, documentation: Optional[str] = None
    ) -> str:
        """格式化表文档"""
        output = f"# {table_info.name} 表文档\n\n"
    
        if table_info.comment:
            output += f"## 表说明\n\n{table_info.comment}\n\n"
    
        if documentation:
            output += f"## 详细文档\n\n{documentation}\n\n"
    
        output += _format_table_info(table_info)
    
        return output
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read-only operation ('获取' - get) but doesn't specify whether this requires authentication, what format the documentation returns (e.g., text, structured data), if there are rate limits, or error conditions. The description is too vague to adequately inform the agent about behavioral traits.

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, efficient sentence in Chinese ('获取表的详细文档说明') that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple tool, though it could be more front-loaded with critical details given the lack of annotations.

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 tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It doesn't explain what 'detailed documentation' entails (e.g., schema, comments, usage examples), how it differs from sibling tools, or behavioral aspects like error handling. The agent lacks sufficient context to use this tool effectively compared to alternatives.

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?

The input schema has 100% description coverage with 'table_name' clearly documented as '表名' (table name). The description doesn't add any parameter-specific details beyond what the schema provides, such as examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate, as the schema does the heavy lifting.

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

Purpose3/5

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

The description '获取表的详细文档说明' (Get detailed documentation for a table) states a clear purpose with a verb ('获取' - get) and resource ('表的详细文档说明' - table's detailed documentation). However, it doesn't differentiate from sibling tools like 'get_table_info' or 'search_tables', leaving ambiguity about what specifically distinguishes this documentation retrieval from general table information.

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 like 'get_table_info' or 'search_tables'. It doesn't mention prerequisites, exclusions, or specific contexts where this tool is preferred, leaving the agent to guess based on tool names alone.

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/JJVvV/sp-enterprise-mcp'

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