refresh_library
Update the Mode Manager MCP Library by synchronizing it with its source URL to ensure accurate and up-to-date data integration.
Instructions
Refresh the Mode Manager MCP Library from its source URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- MCP tool handler function for refresh_library. Calls the library manager's refresh_library method and formats the response as a user-friendly string.def refresh_library() -> str: """Refresh the Mode Manager MCP Library from its source URL.""" try: result = library_manager.refresh_library() if result["status"] == "success": return ( f"{result['message']}\n\n" f"Library: {result['library_name']} (v{result['version']})\n" f"Last Updated: {result['last_updated']}\n" f"Available: {result['total_chatmodes']} chatmodes, {result['total_instructions']} instructions\n\n" f"Use browse_mode_library() to see the updated content." ) else: return f"Refresh failed: {result.get('message', 'Unknown error')}" except FileOperationError as e: return f"Error refreshing library: {str(e)}" except Exception as e: return f"Unexpected error refreshing library: {str(e)}"
- Core helper method in LibraryManager class that performs the library refresh by fetching JSON data from the source URL and returning metadata.def refresh_library(self) -> Dict[str, Any]: """ Refresh the library by fetching the latest version from the URL. Note: Without caching, this method now just fetches the library like any other operation. Returns: Updated library information """ try: library = self._fetch_library() return { "status": "success", "library_name": library.get("name", "Mode Manager MCP Library"), "version": library.get("version", "1.0.0"), "last_updated": library.get("last_updated", "Unknown"), "total_chatmodes": len(library.get("chatmodes", [])), "total_instructions": len(library.get("instructions", [])), "message": "Library refreshed successfully", } except Exception as e: raise FileOperationError(f"Error refreshing library: {str(e)}")
- src/mode_manager_mcp/tools/library_tools.py:17-28 (registration)Tool registration decorator for refresh_library, defining name, description, tags, annotations (schema), and metadata.@app.tool( name="refresh_library", description="Refresh the Mode Manager MCP Library from its source URL.", tags={"public", "library"}, annotations={ "idempotentHint": True, "readOnlyHint": True, "title": "Refresh Library", "returns": "Returns information about the library refresh operation, including library name, version, last updated date, and counts of available chatmodes and instructions. Also provides usage instructions.", }, meta={"category": "library"}, )