Skip to content

get_chat_history: MCP 層未暴露 sinceDate/untilDate/maxMessages 參數 #4

@kiki830621

Description

@kiki830621

Problem

`TDLibClient.getChatHistory()` 已支援 `sinceDate`、`untilDate`、`maxMessages` 三個參數(含 bulk pagination 和 client-side date filtering),但 MCP Server 層(`Server.swift`)未將這些參數暴露給 MCP tool schema,呼叫端無法使用時間區間篩選或指定總筆數上限。

Type

feature

Expected

MCP tool `get_chat_history` 應支援:

  • `since_date` / `until_date`:ISO 8601 或 Unix timestamp,讓呼叫端篩選特定時間範圍的訊息
  • `max_messages`:指定總筆數上限,觸發 TDLibClient 的 bulk pagination 路徑自動翻頁

Actual

MCP tool 只暴露 `chat_id`、`limit`、`from_message_id` 三個參數。

已實作但未接上的 code:

  • `TDLibClient.swift:183-251`:三條路徑(backward-compat / single-page+date-filter / bulk pagination)
  • `Server.swift:345-351`:只傳了 `chatId`、`limit`、`fromMessageId`

Impact

  • 想看「上週的對話」需要手動分頁 + 在 client 端過濾
  • 長對話需要多次呼叫手動翻頁,無法一次指定「給我最多 200 則」
  • Library 層已經做好的功能白費了

Code Reference

  • MCP tool schema:`Server.swift:112-117`(缺少 `since_date` / `until_date` / `max_messages` 宣告)
  • MCP handler:`Server.swift:345-351`(未傳遞新參數給 `tdlib.getChatHistory()`)
  • Library 層已完成:`TDLibClient.swift:183-251`

Current Status

Phase: closed
Last updated: 2026-04-16 by idd-close

Key Decisions

  • Pure wiring: TDLibClient already had sinceDate/untilDate/maxMessages; only Server.swift needed changes
  • MCP params: since_date and until_date as YYYY-MM-DD, max_messages as integer
  • Reused existing parseISODate() helper — consistent with dump_chat_to_markdown
  • Spec updated from 'thin wrapper (3 params)' to '6 params with auto-pagination'
  • Verification: 6-AI cross-review PASS, Codex flagged until_date semantics → 日期處理改善: until_date 語義偏差 + parseISODate 靜默 nil #5

Scope Changes

(none)

Blocking

(none)

Follow-up

Commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions