Skip to main content
Glama
moma1992

Yaizu Smart City MCP Server

by moma1992

list_saved_apis

Display a list of all saved API documentation to quickly access and review available municipal data services and endpoints.

Instructions

保存済みのAPIドキュメント一覧を表示します。

Returns: str: ドキュメント一覧

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_saved_apis' MCP tool. Decorated with @mcp.tool() for automatic registration. Lists all saved API documents by loading metadata from JSON files managed by doc_manager.
    @mcp.tool() async def list_saved_apis() -> str: """ 保存済みのAPIドキュメント一覧を表示します。 Returns: str: ドキュメント一覧 """ try: files = doc_manager.list_available_docs() if not files: return "保存済みのAPIドキュメントがありません。`scrape_api_docs`を実行してください。" output = f"# 保存済みAPIドキュメント\n\n" output += f"**{len(files)}個** のドキュメントが利用可能です:\n\n" for filename in files: # ファイルの情報を取得 doc = doc_manager.load_api_docs(filename) if doc: title = doc.get('title', filename) api_count = len(doc.get('apis', [])) last_updated = doc.get('last_updated', '不明') output += f"## 📄 {filename}\n" output += f"- **タイトル**: {title}\n" output += f"- **API数**: {api_count}\n" output += f"- **最終更新**: {last_updated}\n\n" else: output += f"- {filename}.json\n" return output except Exception as e: logger.error(f"一覧取得エラー: {e}") return f"❌ ドキュメント一覧の取得中にエラーが発生しました: {str(e)}"
  • Helper method in APIDocumentManager class that scans the data directory for available API document JSON files and returns their basenames. Directly called by the list_saved_apis handler.
    def list_available_docs(self) -> List[str]: """利用可能なドキュメントファイルの一覧""" try: files = set() # data/api_specsディレクトリのファイル if self.data_dir.exists(): files.update(f.stem for f in self.data_dir.glob('*.json')) return sorted(list(files)) except Exception as e: logger.error(f"ドキュメント一覧取得エラー: {e}") return []
  • Helper method in APIDocumentManager class that loads a specific API document JSON file by filename. Used in the loop within list_saved_apis to fetch metadata for each document.
    def load_api_docs(self, filename: str = "api_catalog") -> Optional[Dict[str, Any]]: """保存済みのAPIドキュメントを読み込む""" try: # data/api_specsディレクトリを確認 specs_filepath = self.data_dir / f"{filename}.json" if specs_filepath.exists(): with open(specs_filepath, 'r', encoding='utf-8') as f: return json.load(f) data_filepath = self.data_dir / f"{filename}.json" if data_filepath.exists(): with open(data_filepath, 'r', encoding='utf-8') as f: return json.load(f) logger.warning(f"APIドキュメントが見つかりません: {filename}") return None except Exception as e: logger.error(f"APIドキュメント読み込みエラー: {e}") return None
  • mcp/server.py:648-648 (registration)
    The @mcp.tool() decorator registers the list_saved_apis function as an MCP tool.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/moma1992/smartcity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server