search_docs
Search Feishu documents using keywords to find relevant content. Configure the number of results returned.
Instructions
搜索飞书文档
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 搜索关键词 | |
| page_size | No | 返回结果数量(默认10) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/feishu_mcp_server/server.py:70-84 (handler)MCP tool handler for 'search_docs'. Decorated with @mcp.tool(), accepts query (str) and page_size (int, default 10), returns JSON string. Calls client.search_docs() and wraps result in JSON.
@mcp.tool() def search_docs(query: str, page_size: int = 10) -> str: """搜索飞书文档 Args: query: 搜索关键词 page_size: 返回结果数量(默认10) """ if not config.enable_doc: return json.dumps({"error": "文档功能未启用"}, ensure_ascii=False) try: result = client.search_docs(query, page_size) return json.dumps(result, ensure_ascii=False, indent=2, default=str) except Exception as e: return json.dumps({"error": str(e)}, ensure_ascii=False) - FeishuClient.search_docs() - the low-level API client method. Sends POST request to /search/v2/app with search_key, page_size, and app_filter (doc: true) to the Feishu/Lark Search API.
def search_docs(self, query: str, page_size: int = 10) -> dict[str, Any]: """搜索文档""" return self._request( "POST", "/search/v2/app", json_data={ "search_key": query, "page_size": page_size, "app_filter": {"doc": True}, }, ) - src/feishu_mcp_server/server.py:70-71 (registration)Registration of search_docs as an MCP tool via the @mcp.tool() decorator on the search_docs function. FastMCP registers it automatically.
@mcp.tool() def search_docs(query: str, page_size: int = 10) -> str: - Input schema for search_docs: 'query' (str, required) and 'page_size' (int, default 10). Return type is str (JSON-encoded).
@mcp.tool() def search_docs(query: str, page_size: int = 10) -> str: