refresh_library
Update the Mode Manager MCP library from its source URL to ensure access to current chat modes and instructions.
Instructions
Refresh the Mode Manager MCP Library from its source URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'refresh_library' tool. It invokes the library manager's refresh method and formats a user-friendly response string including library details.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)}"
- Supporting method in LibraryManager class that fetches the library JSON from the configured URL and returns metadata about it.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 defining the name, description, tags, annotations, and metadata for the refresh_library tool.@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"}, )
- Annotations providing schema hints for idempotency, read-only status, title, and return description for the tool.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.", },