get_doc_content
Retrieve the raw content of a Feishu document by providing its document ID. Useful for accessing document data programmatically.
Instructions
获取飞书文档的原始内容
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | 飞书文档ID(从URL中获取) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/feishu_mcp_server/server.py:38-51 (handler)The MCP tool handler for 'get_doc_content' — decorated with @mcp.tool(), receives a document_id, checks if doc feature is enabled, calls client.get_doc_content(), and returns the result as JSON.
@mcp.tool() def get_doc_content(document_id: str) -> str: """获取飞书文档的原始内容 Args: document_id: 飞书文档ID(从URL中获取) """ if not config.enable_doc: return json.dumps({"error": "文档功能未启用"}, ensure_ascii=False) try: result = client.get_doc_content(document_id) return json.dumps(result, ensure_ascii=False, indent=2, default=str) except Exception as e: return json.dumps({"error": str(e)}, ensure_ascii=False) - src/feishu_mcp_server/server.py:38-39 (registration)The tool is registered via the @mcp.tool() decorator on the get_doc_content function, making it available in the FastMCP server's tool registry.
@mcp.tool() def get_doc_content(document_id: str) -> str: - The client-side helper method that actually calls the Feishu API. It sends a GET request to /docx/v1/documents/{document_id}/raw_content using the internal _request method.
def get_doc_content(self, document_id: str) -> dict[str, Any]: """获取文档内容""" return self._request("GET", f"/docx/v1/documents/{document_id}/raw_content")