HomeMCP / Tooling【MCP】AIに「10営業日後」を聞くと、なぜ1日ずれるのか|Thousand APIで確実に計算する
【MCP】AIに「10営業日後」を聞くと、なぜ1日ずれるのか|Thousand APIで確実に計算する

【MCP】AIに「10営業日後」を聞くと、なぜ1日ずれるのか|Thousand APIで確実に計算するAI models lack built-in holiday data and business-day counting rules, causing…

AI要点サマリSummary highlight

AIは祝日一覧や起算日の仕様を持たないため営業日計算で1日ずれが生じやすく、Thousand APIをMCP経由で利用することで正確な営業日計算を実現できる。

AI models lack built-in holiday data and business-day counting rules, causing off-by-one errors in deadline calculations; the article shows how to fix this reliably via Thousand API over MCP.

要約と収集メタデータをもとに生成した AI 解説本文です。元記事全文の転載・翻訳ではありません。This AI explainer is generated from the summaries and collected metadata, not from a reproduction or translation of the full source article.

AIエージェントやチャットに「納期はいつか」「返信期限の10営業日後は何日か」と尋ねる場面が増えている。一見すると単純なカレンダー計算に見えるこうした問いで、生成AIがしばしば1日のずれや祝日の見落としを起こすことが指摘されている。Qiitaに投稿された記事は、その原因を整理したうえで、外部APIをMCP(Model Context Protocol)経由で利用して営業日計算を確実に行う方法を紹介している。

問題の根本にあるのは、AIモデルが祝日一覧や「起算日(カウントを開始する日)」の仕様を手元に持たないまま推論している点だとされる。営業日計算は、土日や祝日を除外するルールに加え、当日を1日目として数えるのか翌日から数えるのかといった起算の取り決めによって結果が変わる。人間なら暗黙に補う前提を言語モデルは明示的に持たないため、もっともらしい数字を出しても実際の暦とずれる可能性がある。祝日は国や地域、さらには年ごとに異なり、振替休日のような例外も絡むため、モデルが内部知識だけで正確に扱うのは難しいと考えられる。

記事が解決策として挙げるのが、営業日計算を担う「Thousand API」をMCP経由で呼び出す構成だ。MCPはAIモデルと外部ツールやデータソースを標準化された形式で接続する仕組みで、Anthropicが公開して以降、対応するクライアントやサーバーが広がりつつある。営業日計算のような、正確性が求められ、かつ明確なルールに基づく処理を専用のAPIに委ねることで、モデルが苦手とする厳密な数え上げを外部に肩代わりさせられるという発想だ。

この考え方は営業日計算に限らず、為替レートや在庫数、最新の統計値など、モデルの学習データに含まれない、あるいは頻繁に更新される情報全般に応用できる。生成AIを業務に組み込む際は、モデルの推論に任せる部分と、外部ツールで確実に処理すべき部分を切り分ける設計が重要になると見られる。とりわけ納期や締切のように誤差が実務に直結する領域では、こうしたMCPを介したツール連携が有効な選択肢となりそうだ。導入にあたっては、利用するAPIの対応範囲や仕様を事前に確認しておくことが望ましい。

Ask an AI assistant a seemingly simple question, such as "When is 10 business days after today?" or "What is the delivery deadline?", and the answer may be off by a day. This matters because these date calculations feed into contracts, service-level commitments, reply deadlines, and logistics, where a single day of drift can carry real consequences. The underlying issue is not that a model cannot count, but that it lacks the reference data and the explicit rules needed to count correctly.

The root of the problem is structural. Large language models generate responses by inference over patterns in their training data, and they do not hold an authoritative, up-to-date list of public holidays in memory. Nor do they consistently apply the counting convention, known in Japanese as the 起算日 or "counting-start day," that determines whether the current day is included or excluded when a period is measured. Because these details are ambiguous and vary by jurisdiction and by business practice, a model tends to improvise. The result is the familiar off-by-one error and, more subtly, the silent omission of a national holiday that should have shifted the deadline forward.

Business-day arithmetic is deceptively hard for reasons that have little to do with intelligence. Weekends must be skipped, national holidays must be excluded, and in some organizations company-specific closures or substitute holidays also apply. Rules differ across countries and regions, and holiday calendars change from year to year, sometimes with special one-off dates announced by governments. A model trained on a fixed snapshot of text cannot reliably know next year's holidays, and even when it has seen them, it may not apply the exclusion rules deterministically. What looks like a calendar question is actually a data-and-rules question, and models are weakest precisely where determinism is required.

The article describes addressing this by delegating the calculation to a dedicated external service rather than trusting the model to reason it out. Thousand API is presented as the calculation source, and it is connected to the AI through the Model Context Protocol, commonly abbreviated as MCP. In this arrangement the model no longer guesses. When a user asks for a date offset, the assistant calls the API with the start date, the number of business days, and the relevant holiday set, and receives a precise result computed by code designed for the task. This is a practical example of separating language understanding, which models do well, from exact computation, which is better handled by deterministic tools.

MCP is worth understanding as background because it is the mechanism that makes this pattern portable. Introduced by Anthropic and since adopted more broadly across the industry, MCP is an open standard that defines how AI applications connect to external tools, data sources, and services through a common interface. An MCP server exposes capabilities, in this case a date or business-day calculation, and an MCP-compatible client such as a chat assistant or agent can discover and invoke them. The value is standardization: rather than writing bespoke integrations for every model and every tool, developers expose a service once and reuse it across compatible hosts. This is the same idea behind conventional function calling and tool use, but framed as a shared protocol.

The broader context is a well-documented weakness of language models in tasks that demand exact, verifiable answers, including arithmetic, unit conversion, and date logic. The prevailing remedy across the industry is tool use, where the model recognizes the need for a computation and hands it off to a calculator, a database query, or an API. Retrieval-augmented approaches follow similar logic for factual lookups. Delegating holiday-aware date math to a purpose-built API fits squarely within this design philosophy and tends to be more robust than prompting a model to "be careful" about weekends and holidays.

A few caveats are worth noting. The accuracy of any such setup depends on the correctness and coverage of the holiday data the service uses, so results are only as reliable as the underlying calendar, particularly for regional or company-specific closures. Teams should also confirm which counting convention the API applies, since inclusive and exclusive start dates produce different answers. Even so, the approach described appears to be a sound way to eliminate the off-by-one and missed-holiday errors that arise when a model is left to infer business-day calculations on its own.

  • 出典SourceQiita MCPコミュニティCommunity
  • 直近30件の平均重要度Avg importance, last 301=Info · 2=Medium · 3=High
  • 配信形式FormatブログBlog
  • 重要度Importance重要度 MediumMedium priority(MCP / Tooling 116件中、同等以上 116件)(116 of 116 MCP / Tooling entries are equal or higher)
  • 情報の寿命Half-life📘 中期 (チュートリアル)Medium-term (tutorial)
  • 原文言語Source languageJA
  • 収集日時Collected2026/07/31 06:56

本ページの本文と要約は AI による自動生成です。日本語版と英語版は言語ごとに独立して生成されるため、表現や詳しさが異なる場合があります。正確性は元記事 (qiita.com) をご確認ください。The body and summaries are AI-generated independently for each language, so wording and detail may differ. Verify accuracy at the original source (qiita.com).

🔗MCP / Tooling の他の記事More from MCP / Toolingもっと見る →View more →