Skip to main content
Glama
lm203688

feishu-mcp-server

by lm203688

list_sheets

Retrieve the names of all sheets in a Feishu spreadsheet using the spreadsheet token.

Instructions

获取飞书电子表格的Sheet列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spreadsheet_tokenYes电子表格Token(从URL中获取)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'list_sheets'. It is registered via @mcp.tool() decorator, takes a spreadsheet_token parameter, checks if sheet feature is enabled, delegates to client.list_sheets(), and returns JSON result.
    @mcp.tool()
    def list_sheets(spreadsheet_token: str) -> str:
        """获取飞书电子表格的Sheet列表
    
        Args:
            spreadsheet_token: 电子表格Token(从URL中获取)
        """
        if not config.enable_sheet:
            return json.dumps({"error": "电子表格功能未启用"}, ensure_ascii=False)
        try:
            result = client.list_sheets(spreadsheet_token)
            return json.dumps(result, ensure_ascii=False, indent=2, default=str)
        except Exception as e:
            return json.dumps({"error": str(e)}, ensure_ascii=False)
  • The FeishuClient method that makes the actual HTTP API call to the Feishu/Lark API (GET /sheets/v3/spreadsheets/{token}/sheets/query) to retrieve the list of sheets in a spreadsheet.
    def list_sheets(self, spreadsheet_token: str) -> dict[str, Any]:
        """获取电子表格的Sheet列表"""
        return self._request(
            "GET", f"/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/query"
        )
  • The @mcp.tool() decorator on line 172 registers 'list_sheets' as an MCP tool. The function name becomes the tool name.
    @mcp.tool()
    def list_sheets(spreadsheet_token: str) -> str:
  • The config feature flag 'enable_sheet' (line 18) controls whether the list_sheets tool is allowed to function. If False, the handler returns an error.
    # 功能开关
    enable_doc: bool = Field(default=True, description="启用文档读取")
    enable_message: bool = Field(default=True, description="启用消息发送")
    enable_calendar: bool = Field(default=True, description="启用日历查询")
    enable_sheet: bool = Field(default=True, description="启用电子表格")
  • Test that confirms 'list_sheets' is registered as a tool in the MCP server's tool manager.
    def test_server_has_tools(self):
        tool_names = list(self.server.mcp._tool_manager._tools.keys())
        expected = [
            "get_doc_content", "get_doc_meta", "search_docs",
            "list_chat_messages", "send_message",
            "list_calendars", "list_calendar_events",
            "list_sheets", "get_sheet_values",
        ]
        for t in expected:
            assert t in tool_names, f"缺少工具: {t}"
Behavior2/5

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

No annotations are provided, so the description should disclose behavioral traits such as read-only nature, permissions, or pagination. The description only states the basic function, omitting any details about expected behavior, limitations, or side effects. This is insufficient for a tool with no annotations.

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 sentence, highly efficient, and contains no superfluous information. Every word is necessary to convey the core purpose.

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 simplicity (one parameter, output schema exists), the description is minimally adequate. However, it lacks context about the output format, relationship with sibling tools, and any prerequisites. There is room for improvement to fully guide an AI agent.

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 description coverage is 100% as the single parameter 'spreadsheet_token' has a description in the schema. The tool description does not add any additional meaning or context beyond what the schema provides, but since schema coverage is high, a baseline score of 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 '获取飞书电子表格的Sheet列表' clearly states the action (get list) and the resource (sheets in a spreadsheet). It distinguishes from sibling tools like get_sheet_values, which retrieves cell values, making the tool's specific function unambiguous.

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

Usage Guidelines3/5

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

The description does not provide explicit guidance on when to use this tool versus alternatives. While the context implies it is a prerequisite for accessing sheet values via get_sheet_values, no such relationship is stated. Usage is implied but not clarified.

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/lm203688/feishu-mcp-server'

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