list_calendar_events
Retrieve a list of events from a Feishu calendar by specifying the calendar ID and a time range.
Instructions
获取飞书日历的日程列表
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendar_id | Yes | 日历ID | |
| start_time | Yes | 开始时间(Unix时间戳,秒) | |
| end_time | Yes | 结束时间(Unix时间戳,秒) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/feishu_mcp_server/server.py:149-164 (handler)MCP tool handler function decorated with @mcp.tool(). Takes calendar_id, start_time, end_time as arguments, checks config.enable_calendar flag, calls client.list_calendar_events, and returns JSON response.
@mcp.tool() def list_calendar_events(calendar_id: str, start_time: str, end_time: str) -> str: """获取飞书日历的日程列表 Args: calendar_id: 日历ID start_time: 开始时间(Unix时间戳,秒) end_time: 结束时间(Unix时间戳,秒) """ if not config.enable_calendar: return json.dumps({"error": "日历功能未启用"}, ensure_ascii=False) try: result = client.list_calendar_events(calendar_id, start_time, end_time) 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:149-151 (registration)The tool is registered via the @mcp.tool() decorator on line 149, which registers list_calendar_events as an MCP tool with FastMCP.
@mcp.tool() def list_calendar_events(calendar_id: str, start_time: str, end_time: str) -> str: """获取飞书日历的日程列表 - FeishuClient method that implements the actual API call. Sends a GET request to /calendar/v4/calendars/{calendar_id}/events with start_time, end_time, and page_size (default 50) query parameters.
def list_calendar_events( self, calendar_id: str, start_time: str, end_time: str, page_size: int = 50 ) -> dict[str, Any]: """获取日历事件""" return self._request( "GET", f"/calendar/v4/calendars/{calendar_id}/events", params={ "start_time": start_time, "end_time": end_time, "page_size": page_size, }, ) - Configuration schema: enable_calendar field (default True) controls whether calendar tools (including list_calendar_events) are enabled.
enable_calendar: bool = Field(default=True, description="启用日历查询")