Skip to main content
Glama
moma1992

Yaizu Smart City MCP Server

by moma1992

list_saved_apis

Display a list of saved API documentation for accessing Yaizu City's open data, smart city services, and municipal information.

Instructions

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

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'list_saved_apis' tool. Decorated with @mcp.tool() for registration. Lists all saved API documentation files, loading each to show title, API count, and update info.
    @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)}"
  • Key helper method in APIDocumentManager class that lists available API spec JSON files in data/api_specs directory by scanning file stems. Called by the 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 used by the handler to load individual API documentation JSON files from data/api_specs directory.
    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