mapnetwork-mcp 4.0.0__tar.gz → 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/PKG-INFO +1 -1
  2. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/manifest.json +1 -5
  3. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/mapnetwork_mcp/server.py +35 -75
  4. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/pyproject.toml +1 -1
  5. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/spec/input_schema.json +5 -25
  6. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/spec/output_schema.json +16 -31
  7. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/.github/workflows/workflow.yml +0 -0
  8. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/.gitignore +0 -0
  9. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/.mcpbignore +0 -0
  10. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/LICENSE +0 -0
  11. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/README.md +0 -0
  12. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/RELEASING.md +0 -0
  13. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/SECURITY.md +0 -0
  14. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/images/Kanazawa21Museum-black.png +0 -0
  15. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/images/Kanazawa21Museum-darkGreen.png +0 -0
  16. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/images/Kanazawa21Museum-grey.png +0 -0
  17. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/images/Kanazawa21Museum-lightGreen.png +0 -0
  18. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/images/Kanazawa21Museum-popArt.png +0 -0
  19. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/images/Kanazawa21Museum-white.png +0 -0
  20. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/mapnetwork_mcp/__init__.py +0 -0
  21. {mapnetwork_mcp-4.0.0 → mapnetwork_mcp-5.0.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapnetwork-mcp
3
- Version: 4.0.0
3
+ Version: 5.0.0
4
4
  Summary: MCP server — generate styled map images via mapnetwork.app
5
5
  Project-URL: Homepage, https://mapnetwork.app
6
6
  Project-URL: Repository, https://github.com/toruproject/mapnetwork-mcp
@@ -2,7 +2,7 @@
2
2
  "manifest_version": "0.4",
3
3
  "name": "mapnetwork-mcp",
4
4
  "display_name": "MapNetwork",
5
- "version": "4.0.0",
5
+ "version": "5.0.0",
6
6
  "description": "Generate styled PNG/SVG map images of any location with 11 customizable color themes.",
7
7
  "long_description": "MCP server for MapNetwork — generate styled map images (PNG / SVG) for any location on Earth, directly from Claude.\n\n- Generate maps from a place name, coordinates, or a list of markers\n- 11 color themes (white, darkBlue, darkGreen, popArt, lightBlue, lightGreen, beige, magenta, gray, black, brawn)\n- Overlay walking / driving routes on the map\n- PNG or SVG output, saved to your Downloads folder\n- Re-download a previously generated map in a different theme or format without regenerating\n- Open any generated map in the MapNetwork web editor for manual customization",
8
8
  "author": {
@@ -35,10 +35,6 @@
35
35
  "name": "generate_route_map",
36
36
  "description": "Compute a walking or driving route between two places and generate a map with it overlaid"
37
37
  },
38
- {
39
- "name": "generate_hyperlink_map",
40
- "description": "Generate a map with pinned locations that are clickable links to their official websites"
41
- },
42
38
  {
43
39
  "name": "check_map_status",
44
40
  "description": "Poll a pending map generation job and download it once ready"
@@ -33,9 +33,9 @@ CHECK_THROTTLE_SEC = 5.0
33
33
  # extra="ignore"がデフォルトのため気づかれずに黙って無視されていたことが判明した)。
34
34
 
35
35
  class Marker(BaseModel):
36
- """generate_markers_map/generate_hyperlink_map共通。labelは必須、linkは任意で公式サイトURLを
37
- 付けられる。generate_markers_mapはlink無しのマーカーが混在してもよく(むしろ通常はこちら)、
38
- generate_hyperlink_mapは少なくとも1つのマーカーがlinkを持つことを要求する(ツール側で検証)。"""
36
+ """generate_markers_mapのマーカー。labelは必須、linkは任意で公式サイトURLを付けられる
37
+ (バックエンド側がPlaces APIで自動補完する場合も多いが、モデルが確度高く知っている場合は
38
+ 明示的に渡してもよい)。link無しのマーカーが混在してもよい(むしろ通常はこちら)。"""
39
39
  model_config = ConfigDict(extra="forbid")
40
40
 
41
41
  label: str = Field(description="Place name to geocode and display.")
@@ -53,22 +53,18 @@ mcp = FastMCP(
53
53
  "## Key capabilities — pick the tool that matches what you need\n"
54
54
  "- **Single location**: `generate_map(place=...)` — centers a map on one place.\n"
55
55
  "- **Multiple pinned locations**: `generate_markers_map(markers=[{\"label\": ...}, ...])` — "
56
- "pins several places on one map. Each marker needs a `label`. Use this whenever the user "
57
- "asks to show multiple places on a single map.\n"
56
+ "pins several places on one map. Each marker needs a `label`, and may optionally include "
57
+ "`link` (its official website URL, if known) to make that pin a clickable link in the "
58
+ "result's 'Open in editor' link. Use this whenever the user asks to show multiple places "
59
+ "on a single map, or wants a map they (or someone else) can click through to visit the "
60
+ "pinned places' websites.\n"
58
61
  "- **Walking/driving route**: `generate_route_map(from=..., to=..., mode=...)` — computes a "
59
- "route between two places and draws it on the map, with both endpoints pinned automatically. "
60
- "`mode` is 'walking' (default) or 'driving'.\n"
61
- "- **Hyperlink map**: `generate_hyperlink_map(markers=[{\"label\": ..., \"link\": ...}, ...])` "
62
- "— like generate_markers_map, but produces a map where markers are clickable links to their "
63
- "official websites. Set `link` on any marker whose official website you already know (e.g. "
64
- "from search results or prior knowledge); at least one marker must have `link` set, or the "
65
- "call errors. Use this whenever the user wants a map they (or someone else) can click "
66
- "through to visit the pinned places' websites.\n"
67
- "- Every generate_* call produces a PNG at default size and theme — see 'Important: "
68
- "re-download without regenerating' below to view it differently.\n\n"
62
+ "route between two places and draws it on the map.\n"
63
+ "- Every generate_* call produces a PNG at the default color theme — see 'Important: "
64
+ "re-download without regenerating' below to change the theme or format without regenerating.\n\n"
69
65
  "## If generation is still in progress\n"
70
66
  "For busy areas, any generate_* tool may return before the map is ready, with a `dataKey` "
71
- "and a message asking you to check back. In that case, wait about 20-30 seconds and "
67
+ "and a message asking you to check back. In that case, wait about 10-20 seconds and "
72
68
  "call `check_map_status(data_key=...)` — do not call the generate_* tool again for the same "
73
69
  "request, that only starts a redundant duplicate job. Repeat `check_map_status` "
74
70
  "(with the same wait between calls) until it returns the image.\n\n"
@@ -80,9 +76,8 @@ mcp = FastMCP(
80
76
  "MapNetwork supports 11 color themes (white, darkBlue, darkGreen, popArt, lightBlue, "
81
77
  "lightGreen, beige, magenta, gray, black, brawn).\n\n"
82
78
  "## Sharing the generated map\n"
83
- "Every successful result includes a Download link, plus either a 'Hyperlink Map' link "
84
- "(read-only, linked markers clickable) or an 'Open in editor' link. "
85
- "Mention whichever one you receive.\n\n"
79
+ "Every successful result includes a Download link and an 'Open in editor' link — "
80
+ "mention both to the user.\n\n"
86
81
  "## Parameter discipline\n"
87
82
  "- **place/label**: `place`, a marker's `label`, and route's `from`/`to` must each be a "
88
83
  "place name specific enough for the server to geocode it to a single, unambiguous "
@@ -156,19 +151,19 @@ async def _poll_with_budget(
156
151
 
157
152
  def _build_success_result(image_bytes: bytes, out_path: Path, data_key: str, has_link: bool) -> list:
158
153
  out_path.write_bytes(image_bytes)
159
- # linkを持つマーカーが1つでもあれば閲覧専用(lock)リンクを、無ければ編集用リンクを返す。
154
+ # linkを持つマーカーが1つでもあれば、"Open in editor"を閲覧専用(lock)モードのURLにする。
160
155
  # どのツールを呼んだかではなく実際に生成されたplaceDictの中身で判定している(_has_any_link)。
161
- link_line = (
162
- f"hyperlink Map: https://mapnetwork.app/generate?dataKey={data_key}&lock=true"
163
- if has_link else
164
- f"Open in editor: https://mapnetwork.app/generate?dataKey={data_key}"
165
- )
156
+ editor_url = f"https://mapnetwork.app/generate?dataKey={data_key}"
157
+ if has_link:
158
+ editor_url += "&lock=true"
159
+ download_url = f"https://mapnetwork.app/download?dataKey={data_key}"
166
160
  return [
167
161
  Image(data=image_bytes, format="png"),
168
162
  (
169
163
  f"Map saved: {out_path}\n"
170
164
  f"dataKey: {data_key}\n\n"
171
- f"{link_line}\n\n"
165
+ f"Download: {download_url}\n"
166
+ f"Open in editor: {editor_url}\n\n"
172
167
  f"Tip: call redownload_map(data_key='{data_key}', ...) to get this map "
173
168
  f"in a different color theme or format (svg/png) without regenerating."
174
169
  ),
@@ -185,10 +180,12 @@ def _still_in_progress_result(data_key: str) -> list:
185
180
  )]
186
181
 
187
182
 
188
- async def _generate_map_common(body: dict, ctx: Context | None) -> list:
189
- """4つのgenerate_*ツール共通のenqueue→poll→download→has_link判定→結果構築フロー。
190
- body["name"]をファイル名の元にも使う。常にformat="png"・デフォルトcolor_setで
191
- ダウンロードする(別の見た目が欲しければredownload_mapで取り直す)。"""
183
+ async def _generate_map_common(body: dict, ctx: Context | None, label: str | None = None) -> list:
184
+ """3つのgenerate_*ツール共通のenqueue→poll→download→has_link判定→結果構築フロー。
185
+ labelはダウンロードファイル名の元にのみ使う(バックエンド側もplace/markers/routeから
186
+ 同じ表示名をconfigDict.nameとして独自に導出するため、bodyには含めない)。
187
+ 常にformat="png"・デフォルトcolor_setでダウンロードする(別の見た目が欲しければ
188
+ redownload_mapで取り直す)。"""
192
189
  async with httpx.AsyncClient() as client:
193
190
  # 1. Enqueue
194
191
  resp = await client.post(f"{BASE_URL}/request", json=body, timeout=30)
@@ -219,8 +216,7 @@ async def _generate_map_common(body: dict, ctx: Context | None) -> list:
219
216
  image_bytes = await _download(client, data_key, "png", None)
220
217
  has_link = await _has_any_link(client, data_key)
221
218
 
222
- label = body.get("name") or data_key
223
- return _build_success_result(image_bytes, _make_filename(label, "png"), data_key, has_link)
219
+ return _build_success_result(image_bytes, _make_filename(label or data_key, "png"), data_key, has_link)
224
220
 
225
221
 
226
222
  # ---------------------------------------------------------------------------
@@ -236,8 +232,8 @@ async def generate_map(
236
232
 
237
233
  Example: generate_map(place="Tokyo Station")
238
234
  """
239
- body: dict = {"place": place, "name": place}
240
- return await _generate_map_common(body, ctx)
235
+ body: dict = {"place": place}
236
+ return await _generate_map_common(body, ctx, label=place)
241
237
 
242
238
 
243
239
  # ---------------------------------------------------------------------------
@@ -257,15 +253,15 @@ async def generate_markers_map(
257
253
  ) -> list:
258
254
  """Generate a map with multiple pinned locations.
259
255
 
260
- Example: generate_markers_map(markers=[{"label": "Tokyo Tower"}, {"label": "Zojoji Temple"}])
256
+ Example: generate_markers_map(markers=[{"label": "Tokyo Tower", "link": "https://www.tokyotower.co.jp/"}, {"label": "Zojoji Temple"}])
261
257
  """
262
258
  if not markers:
263
259
  raise ValueError("'markers' must contain at least one marker.")
264
260
  label = place or "_".join(m.label for m in markers)[:40]
265
- body: dict = {"markers": [m.model_dump(exclude_none=True) for m in markers], "name": label}
261
+ body: dict = {"markers": [m.model_dump(exclude_none=True) for m in markers]}
266
262
  if place:
267
263
  body["place"] = place
268
- return await _generate_map_common(body, ctx)
264
+ return await _generate_map_common(body, ctx, label=label)
269
265
 
270
266
 
271
267
  # ---------------------------------------------------------------------------
@@ -296,46 +292,10 @@ async def generate_route_map(
296
292
  # いたが、それだと地図生成用の道路データ取得と合わせて同じ範囲の道路網を2回取得する
297
293
  # ことになっていたため、サーバー側で1回にまとめた)。
298
294
  label = place or "route"
299
- body: dict = {"route": {"from": {"label": from_}, "to": {"label": to}, "mode": mode}, "name": label}
300
- if place:
301
- body["place"] = place
302
- return await _generate_map_common(body, ctx)
303
-
304
-
305
- # ---------------------------------------------------------------------------
306
- # Tool: generate_hyperlink_map
307
- # ---------------------------------------------------------------------------
308
-
309
- @mcp.tool()
310
- async def generate_hyperlink_map(
311
- markers: Annotated[
312
- list[Marker],
313
- Field(description="Locations to pin. At least one required, and at least one marker must "
314
- "have 'link' set (its official website URL) — otherwise use generate_markers_map instead."),
315
- ],
316
- place: Annotated[
317
- str | None,
318
- Field(description="Optional: place to center the map on. If omitted, the center is computed automatically from the markers."),
319
- ] = None,
320
- ctx: Context = None,
321
- ) -> list:
322
- """Generate a map with pinned locations whose website links are clickable in the resulting map link.
323
- Requires at least one marker to have 'link' set — use generate_markers_map if none do.
324
-
325
- Example: generate_hyperlink_map(markers=[{"label": "Tokyo Tower", "link": "https://www.tokyotower.co.jp/"}])
326
- """
327
- if not markers:
328
- raise ValueError("'markers' must contain at least one marker.")
329
- if not any(m.link for m in markers):
330
- raise ValueError(
331
- "generate_hyperlink_map requires at least one marker with 'link' set. "
332
- "Use generate_markers_map instead if no marker has a link."
333
- )
334
- label = place or "_".join(m.label for m in markers)[:40]
335
- body: dict = {"markers": [m.model_dump(exclude_none=True) for m in markers], "name": label}
295
+ body: dict = {"route": {"from": {"label": from_}, "to": {"label": to}, "mode": mode}}
336
296
  if place:
337
297
  body["place"] = place
338
- return await _generate_map_common(body, ctx)
298
+ return await _generate_map_common(body, ctx, label=label)
339
299
 
340
300
 
341
301
  # ---------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mapnetwork-mcp"
3
- version = "4.0.0"
3
+ version = "5.0.0"
4
4
  description = "MCP server — generate styled map images via mapnetwork.app"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "MapNetwork MCP - 入力JSON仕様",
4
- "description": "mapnetwork_mcp/server.py で定義されている6つのMCPツールの入力パラメータ仕様。各属性の型・デフォルト値・設定可能値(enum)・制約を示す。",
4
+ "description": "mapnetwork_mcp/server.py で定義されている5つのMCPツールの入力パラメータ仕様。各属性の型・デフォルト値・設定可能値(enum)・制約を示す。",
5
5
  "definitions": {
6
6
  "Marker": {
7
7
  "type": "object",
8
- "description": "generate_markers_map/generate_hyperlink_map共通。地図上にピン留めする地点。labelは必須、linkは任意で公式サイトURLを付けられる。generate_markers_mapはlink無しのマーカーが混在してもよい(むしろ通常はこちら)。generate_hyperlink_mapは、markers全体のうち少なくとも1件がlinkを持つことをツール側で検証する(ツールごとに別モデルは存在しない)",
8
+ "description": "generate_markers_mapが使う、地図上にピン留めする地点。labelは必須、linkは任意で公式サイトURLを付けられる(バックエンド側がPlaces APIで自動補完する場合も多い)。link無しのマーカーが混在してもよい(むしろ通常はこちら)。以前はgenerate_hyperlink_mapという別ツールが同じMarker型を使い、markers全体のうち少なくとも1件がlinkを持つことを追加要求していたが、Places APIによるlink自動補完でgenerate_markers_mapとの差が実質無くなったため廃止された",
9
9
  "properties": {
10
10
  "label": { "type": "string", "description": "地名(ジオコーディング・表示用)" },
11
11
  "link": { "type": ["string", "null"], "default": null, "description": "その地点の公式サイトURL(既知の場合のみ設定)" }
@@ -36,7 +36,7 @@
36
36
  "example": { "place": "Tokyo Station" }
37
37
  },
38
38
  "generate_markers_map": {
39
- "description": "複数の地点をピン留めした地図画像を生成する。各地点は任意でlinkを持てる(generate_hyperlink_mapと違い必須ではない、一部/全部/どれもlinkを持たなくてもよい)。常にデフォルトのカラーテーマ・PNG形式でダウンロードする",
39
+ "description": "複数の地点をピン留めした地図画像を生成する。各地点は任意でlinkを持てる(一部/全部/どれもlinkを持たなくてもよい)。常にデフォルトのカラーテーマ・PNG形式でダウンロードする",
40
40
  "type": "object",
41
41
  "properties": {
42
42
  "markers": {
@@ -50,10 +50,10 @@
50
50
  "required": ["markers"],
51
51
  "constraints": [
52
52
  "markersは1件以上必須(link有無は問わない。1件もlinkを持たないのが通常のケース)",
53
- "markersのいずれかがlinkを持つ場合、成功レスポンスは編集用リンクの代わりに閲覧専用(lock)のhyperlink Mapリンクを返す(generate_hyperlink_mapを呼んだ場合と同じ挙動。判定はどのツールを呼んだかではなく実データによる)",
53
+ "markersのいずれかがlink(明示指定またはバックエンド側のPlaces API自動補完)を持つ場合、成功レスポンスの'Open in editor'リンクに&lock=trueが付き、閲覧専用モードでそのmarkerがクリック可能になる(判定はどのツールを呼んだかではなく実データによる)",
54
54
  "configDict.nameにはサーバー側がplace(未指定ならmarkersのlabelを連結した文字列)を自動設定する"
55
55
  ],
56
- "example": { "markers": [{ "label": "Tokyo Tower" }, { "label": "Zojoji Temple" }] }
56
+ "example": { "markers": [{ "label": "Tokyo Tower", "link": "https://www.tokyotower.co.jp/" }, { "label": "Zojoji Temple" }] }
57
57
  },
58
58
  "generate_route_map": {
59
59
  "description": "2地点間の徒歩/車ルートを計算し、それを重ねた地図画像を1回の呼び出しで生成する。ルート探索と地図生成が別ツールに分かれていた旧設計(compute_route→generate_route_mapの2段階)は、MCPホスト側にとって難易度が高すぎたため統合された。ルートの両端点は地図上に自動でピン留めされる。常にデフォルトのカラーテーマ・PNG形式でダウンロードする",
@@ -77,26 +77,6 @@
77
77
  ],
78
78
  "example": { "from": "Tokyo Station", "to": "Tokyo Tower", "mode": "walking" }
79
79
  },
80
- "generate_hyperlink_map": {
81
- "description": "generate_markers_mapと同一のツール(markers/placeの形も同じ、Marker定義も共通)だが、markersのうち少なくとも1件がlinkを持つことを追加で要求する。全markerがlink無しだとエラーになる。linkを持つ地点があると、生成結果は編集用リンクの代わりに閲覧専用(lock)のhyperlink Mapリンクを返す。常にデフォルトのカラーテーマ・PNG形式でダウンロードする",
82
- "type": "object",
83
- "properties": {
84
- "markers": {
85
- "type": "array",
86
- "description": "地図上にピン留めする地点リスト(1件以上必須、かつ少なくとも1件はlinkを持つ必要がある)",
87
- "items": { "$ref": "#/definitions/Marker" },
88
- "minItems": 1
89
- },
90
- "place": { "type": ["string", "null"], "default": null, "description": "地図の中心とする地名。未指定ならmarkersの座標群から自動計算される" }
91
- },
92
- "required": ["markers"],
93
- "constraints": [
94
- "markersは1件以上必須",
95
- "markersのうち少なくとも1件はlinkを持つ必要がある(ツール側でバリデーション、Marker定義自体はlinkを任意としている)。持たない場合はエラーになり、generate_markers_mapの使用を促すメッセージが返る",
96
- "configDict.nameにはサーバー側がplace(未指定ならmarkersのlabelを連結した文字列)を自動設定する"
97
- ],
98
- "example": { "markers": [{ "label": "Zojoji Temple" }, { "label": "Tokyo Tower", "link": "https://www.tokyotower.co.jp/" }] }
99
- },
100
80
  "check_map_status": {
101
81
  "description": "generate_*ツールが未完了(pending)を返した場合のジョブをポーリングし、完了していればデフォルトのカラーテーマ・PNG形式でダウンロードする",
102
82
  "type": "object",
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "MapNetwork MCP - 出力JSON仕様",
4
- "description": "mapnetwork_mcp/server.py で定義されている6つのMCPツールの戻り値(MCPのCallToolResult)の仕様。各ツールの実装(FastMCPの変換ルールを含む)から実機検証して起こしたもの。",
4
+ "description": "mapnetwork_mcp/server.py で定義されている5つのMCPツールの戻り値(MCPのCallToolResult)の仕様。各ツールの実装(FastMCPの変換ルールを含む)から実機検証して起こしたもの。",
5
5
  "notes": [
6
- "全ツールとも戻り値の型注釈が具体的な型パラメータを持たない 'list' であるため、FastMCPは構造化出力(structuredContent/tools/listのoutputSchema)を生成しない。実機確認済み:6ツールすべてtools/listのoutputSchemaはnull、tools/callのstructuredContentも常にnull。呼び出し側はcontent配列(テキスト/画像)のみをパースすればよい。",
7
- "全6ツールとも'list'を返す関数で、リストの各要素がFastMCPによってcontentの1項目に変換される:Imageインスタンス→ImageContent、文字列→TextContent。",
6
+ "全ツールとも戻り値の型注釈が具体的な型パラメータを持たない 'list' であるため、FastMCPは構造化出力(structuredContent/tools/listのoutputSchema)を生成しない。実機確認済み:5ツールすべてtools/listのoutputSchemaはnull、tools/callのstructuredContentも常にnull。呼び出し側はcontent配列(テキスト/画像)のみをパースすればよい。",
7
+ "全5ツールとも'list'を返す関数で、リストの各要素がFastMCPによってcontentの1項目に変換される:Imageインスタンス→ImageContent、文字列→TextContent。",
8
8
  "ツール内で例外(ValueError/RuntimeError、または引数バリデーション失敗によるpydantic.ValidationError、httpxの接続エラー等)が送出された場合、FastMCPがそれを捕捉し、isError=trueと単一のTextContentに包んで返す。テキストの形式は常に 'Error executing tool <tool_name>: <str(exception)>'。ツール関数の中身でtry/exceptしてエラーメッセージを整形している箇所(Request rejected/Map generation failed等)もこの共通ラッパーの中を通る。",
9
9
  "pydantic.ValidationErrorのstr()は複数行になる(フィールドパス、エラー種別、入力値、pydantic.devのドキュメントURLを含む)。例:\"1 validation error for generate_markers_mapArguments\\nmarkers.0.place\\n Extra inputs are not permitted [type=extra_forbidden, input_value='Tokyo', input_type=str]\\n For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden\"",
10
10
  "redownload_mapのImageContentのmimeTypeは、指定したformat引数に連動する:format='png'なら'image/png'、format='svg'なら'image/svg+xml'(SVGの正式なMIMEタイプ。Image(format=...)ヘルパーはformat文字列をそのまま'image/{format}'に埋め込むだけなので、サーバー側で'svg'→'svg+xml'に変換してから渡している。過去バージョンではformat='svg'でもmimeTypeが常に'image/png'になる不具合があったが修正済み)。"
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "MapSuccessResult": {
79
79
  "type": "object",
80
- "description": "地図が生成/取得できた場合の共通の成功形。generate_*系4ツール・check_map_status・redownload_mapすべてがこの形で返す",
80
+ "description": "地図が生成/取得できた場合の共通の成功形。generate_*系3ツール・check_map_status・redownload_mapすべてがこの形で返す",
81
81
  "properties": {
82
82
  "isError": { "const": false },
83
83
  "structuredContent": { "const": null },
@@ -92,7 +92,7 @@
92
92
  "properties": {
93
93
  "text": {
94
94
  "type": "string",
95
- "description": "'Map saved: <ローカル保存パス>\\ndataKey: <dataKey>\\n\\n<hyperlink Map: .../generate?dataKey=...&lock=true か Open in editor: .../generate?dataKey=...>\\n\\nTip: call redownload_map(...) ...' の形式(generate_*/check_map_statusの場合)。redownload_mapのみ形式が異なる(下記参照)"
95
+ "description": "'Map saved: <ローカル保存パス>\\ndataKey: <dataKey>\\n\\nDownload: .../download?dataKey=...\\nOpen in editor: .../generate?dataKey=...[&lock=true]\\n\\nTip: call redownload_map(...) ...' の形式(generate_*/check_map_statusの場合)。&lock=trueはlinkを持つmarkerが1件でもある場合にのみ付く。redownload_mapのみ形式が異なる(下記参照)"
96
96
  }
97
97
  }
98
98
  }
@@ -110,12 +110,13 @@
110
110
  "error": { "$ref": "#/definitions/ErrorResult" }
111
111
  },
112
112
  "notes": [
113
- "successのcontent[1].textにある2行目のリンクは、生成された地図のplaceDictにlinkを持つマーカーが1つでもあるかどうかで動的に切り替わる(_has_any_link):",
114
- " linkあり: 'hyperlink Map: https://mapnetwork.app/generate?dataKey=<dataKey>&lock=true'",
113
+ "successのcontent[1].textにあるOpen in editorリンクは、生成された地図のplaceDictにlinkを持つマーカーが1つでもあるかどうかで&lock=trueの有無が動的に切り替わる(_has_any_link):",
114
+ " linkあり: 'Open in editor: https://mapnetwork.app/generate?dataKey=<dataKey>&lock=true'",
115
115
  " linkなし: 'Open in editor: https://mapnetwork.app/generate?dataKey=<dataKey>'",
116
- "generate_mapはmarkersを持たないので、通常はlinkなし('Open in editor')になる"
116
+ "generate_mapはmarkersを持たないので、通常はlinkなし(&lock=trueなし)になる",
117
+ "Downloadリンク(https://mapnetwork.app/download?dataKey=<dataKey>)も常に含まれる"
117
118
  ],
118
- "example_success_text": "Map saved: C:\\Users\\you\\Downloads\\map_Tokyo_Station_20260618_120000.png\ndataKey: 20260618aBcDeFgHiJ\n\nOpen in editor: https://mapnetwork.app/generate?dataKey=20260618aBcDeFgHiJ\n\nTip: call redownload_map(data_key='20260618aBcDeFgHiJ', ...) to get this map in a different color theme or format (svg/png) without regenerating.",
119
+ "example_success_text": "Map saved: C:\\Users\\you\\Downloads\\map_Tokyo_Station_20260618_120000.png\ndataKey: 20260618aBcDeFgHiJ\n\nDownload: https://mapnetwork.app/download?dataKey=20260618aBcDeFgHiJ\nOpen in editor: https://mapnetwork.app/generate?dataKey=20260618aBcDeFgHiJ\n\nTip: call redownload_map(data_key='20260618aBcDeFgHiJ', ...) to get this map in a different color theme or format (svg/png) without regenerating.",
119
120
  "example_error_texts": [
120
121
  "Error executing tool generate_map: All connection attempts failed",
121
122
  "Error executing tool generate_map: Request rejected (400): <backend error detail>",
@@ -129,8 +130,8 @@
129
130
  "error": { "$ref": "#/definitions/ErrorResult" }
130
131
  },
131
132
  "notes": [
132
- "generate_markers_mapとgenerate_hyperlink_mapはmarkersの型(Marker: label必須+link任意)を共有しており、generate_markers_mapのmarkerにlinkを設定してもエラーにならない。link有無を問わずmarkersが1件以上あれば成功する(全markerがlink無しなのが通常のケースだが、必須ではない)。",
133
- "markersの中にlinkを持つものが1件でもあれば、successのcontent[1].textの2行目が'hyperlink Map: .../generate?dataKey=...&lock=true'になる(generate_hyperlink_mapを呼んだ場合と同じ判定ロジック、_has_any_link)。全markerがlink未設定なら'Open in editor'になる。"
133
+ "markersのMarker型(label必須+link任意)はlink有無を問わず1件以上あれば成功する(全markerがlink無しなのが通常のケースだが、必須ではない)。",
134
+ "markersの中にlinkを持つものが1件でもあれば、successのcontent[1].textのOpen in editorリンクに'&lock=true'が付く(_has_any_link)。全markerがlink未設定なら付かない。"
134
135
  ],
135
136
  "example_error_texts": [
136
137
  "Error executing tool generate_markers_map: 'markers' must contain at least one marker.",
@@ -145,7 +146,7 @@
145
146
  },
146
147
  "notes": [
147
148
  "compute_routeという別ツールは存在せず(廃止済み)、専用のルート探索エンドポイントも存在しない(こちらも廃止済み)。generate_route_mapは{\"from\":{\"label\":...}, \"to\":{\"label\":...}, \"mode\":...}をそのままバックエンドの/requestのrouteフィールドに詰めて1回だけ送るだけで、ジオコード・ルート探索・地図生成は全てバックエンドのワーカー内(build_map_data)で行われる。ルート探索は地図生成用に取得した道路データをそのまま再利用するため、道路網の二重取得が発生しない。",
148
- "from/toはmarkerとして自動でピン留めされるが、linkを持たせる手段は無い。そのため生成データにlinkを持つエントリは発生せず、成功時のリンクは常に'Open in editor'になる。",
149
+ "from/toはmarkerとして自動でピン留めされるが、linkを持たせる手段は無い。そのため生成データにlinkを持つエントリは発生せず、成功時のOpen in editorリンクに'&lock=true'は付かない。",
149
150
  "ルート探索がバックエンド内(ワーカー)で行われるため、「ルートが見つからない」等の失敗はgenerate_route_map呼び出し時点では判明せず、他のgenerate_*ツールと同じ一般的な地図生成失敗('Map generation failed (dataKey=...). Try a different location.')として現れる。INITIAL_WAIT_SEC(40秒)以内に失敗が判明すればそのままエラーとして返るが、それより時間がかかる場合は一旦pendingが返り、check_map_status経由で最終的に失敗が判明する。"
150
151
  ],
151
152
  "example_error_texts": [
@@ -155,22 +156,6 @@
155
156
  "Error executing tool generate_route_map: 1 validation error for generate_route_mapArguments\nmode\n Input should be 'walking' or 'driving' [type=literal_error, input_value='flying', input_type=str]\n For further information visit https://errors.pydantic.dev/2.13/v/literal_error"
156
157
  ]
157
158
  },
158
- "generate_hyperlink_map": {
159
- "returns": {
160
- "success": { "$ref": "#/definitions/MapSuccessResult" },
161
- "pending": { "$ref": "#/definitions/PendingResult" },
162
- "error": { "$ref": "#/definitions/ErrorResult" }
163
- },
164
- "notes": [
165
- "generate_markers_mapと同一のMarker型(label必須+link任意)を使うが、ツール本体が追加のバリデーションとして「markersのうち少なくとも1件はlinkを持つこと」を要求する(Pydanticモデルのextra=\"forbid\"とは別に、関数内でanyチェックしている)。1件も持たない場合は下記example_error_textsの3件目のエラーになる。",
166
- "markersの中にlinkを持つものが1件でもあれば、successのcontent[1].textの2行目が'hyperlink Map: .../generate?dataKey=...&lock=true'になる(バリデーションを通過した時点で必ず1件以上linkを持つため、generate_hyperlink_mapの成功結果は常にhyperlink Mapリンクになり、'Open in editor'にはならない)。"
167
- ],
168
- "example_error_texts": [
169
- "Error executing tool generate_hyperlink_map: 'markers' must contain at least one marker.",
170
- "Error executing tool generate_hyperlink_map: 1 validation error for generate_hyperlink_mapArguments\nmarkers.0.place\n Extra inputs are not permitted [type=extra_forbidden, input_value='Tokyo', input_type=str]\n For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden",
171
- "Error executing tool generate_hyperlink_map: generate_hyperlink_map requires at least one marker with 'link' set. Use generate_markers_map instead if no marker has a link."
172
- ]
173
- },
174
159
  "check_map_status": {
175
160
  "returns": {
176
161
  "success": { "$ref": "#/definitions/MapSuccessResult" },
@@ -179,7 +164,7 @@
179
164
  },
180
165
  "notes": [
181
166
  "successの場合、_make_filename(data_key, \"png\")でファイル名を作るため、保存パスのslugにはdataKeyがそのまま使われる(generate_*の成功時はplace/markerラベル由来のslugになるのと異なる)。",
182
- "hyperlink Map / Open in editorの出し分けは、check_map_status呼び出し時点で実データのplaceDictを再取得して判定する(元のツール呼び出しがgenerate_hyperlink_mapだったかどうかには依存しない)。",
167
+ "Open in editorリンクへの&lock=true付与は、check_map_status呼び出し時点で実データのplaceDictを再取得して判定する(元のgenerate_*ツール呼び出しの引数には依存しない)。",
183
168
  "呼び出しごとにCHECK_THROTTLE_SEC(5秒)のスリープが必ず入るため、pending応答であっても即座には返らない。"
184
169
  ]
185
170
  },
@@ -211,7 +196,7 @@
211
196
  "text": {
212
197
  "type": "string",
213
198
  "pattern": "^Map saved: .+ \\(dataKey=.+, colorSet=.*, format=(png|svg)\\)$",
214
- "description": "'Map saved: <path> (dataKey=<dataKey>, colorSet=<color_set|None>, format=<png|svg>)'。generate_*系と異なりhyperlink Map/Open in editorのリンク案内は含まれない"
199
+ "description": "'Map saved: <path> (dataKey=<dataKey>, colorSet=<color_set|None>, format=<png|svg>)'。generate_*系と異なりDownload/Open in editorのリンク案内は含まれない"
215
200
  }
216
201
  }
217
202
  }
@@ -224,7 +209,7 @@
224
209
  },
225
210
  "notes": [
226
211
  "redownload_mapにはpendingパターンはない(既存dataKeyのデータを即座にダウンロードするだけで、生成ジョブのポーリングを行わない)。",
227
- "successのテキストにはlinkの有無による出し分け(hyperlink Map / Open in editor)が含まれない。元のgenerate_*呼び出し結果に含まれていたリンクをそのまま使い回す想定。",
212
+ "successのテキストにはDownload/Open in editorのリンク案内自体が含まれない。元のgenerate_*呼び出し結果に含まれていたリンクをそのまま使い回す想定。",
228
213
  "color_setを指定しない場合、text内は'colorSet=None'という文字列になる(Pythonのf-stringでNoneがそのまま埋め込まれるため)。"
229
214
  ],
230
215
  "example_success_text": "Map saved: C:\\Users\\you\\Downloads\\map_20260618aBcDeFgHiJ_20260618_120500.svg (dataKey=20260618aBcDeFgHiJ, colorSet=black, format=svg)",
File without changes
File without changes
File without changes